/* ==========================================================================
   História Cantada — componentes reutilizáveis
   Botão · card · opção de escolha · campo · vinil · player · progresso
   ========================================================================== */

/* ==========================================================================
   BOTÃO
   Altura mínima de 48px: alvo de toque confortável no celular.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: var(--sp-3) var(--sp-6);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-enter),
    transform        var(--dur-fast) var(--ease-enter),
    box-shadow       var(--dur-fast) var(--ease-enter);
}

.btn:active { transform: scale(.98); }

/* Primário: dourado de preenchimento com texto escuro em cima.
   Contraste 7.6:1 — por isso o texto é --ink e não branco. */
.btn-primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.btn-primary:hover { background: var(--gold-strong); }

.btn-green {
  background: var(--green);
  color: var(--ink-invert);
}
.btn-green:hover { background: #125730; }

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-outline:hover { border-color: var(--gold-ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  min-height: 44px;
  padding-inline: var(--sp-3);
  font-weight: 500;
}
.btn-ghost:hover { color: var(--ink); }

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

.btn-lg {
  min-height: 56px;
  font-size: var(--text-lg);
  padding-inline: var(--sp-8);
}

/* Desabilitado: opacidade reduzida, cursor bloqueado e sem ação.
   O atributo disabled é o que realmente impede o clique — o CSS só comunica. */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Carregando: mostra spinner e bloqueia clique duplo */
.btn.is-loading { pointer-events: none; color: transparent; position: relative; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid rgba(35, 31, 32, .3);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

/* ==========================================================================
   CARD
   ========================================================================== */

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

.card-lift { box-shadow: var(--shadow-lift); }

.card-featured {
  border: 2px solid var(--gold-ink);
  box-shadow: var(--shadow-lift);
}

/* Selo "★ Mais escolhido" */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--gold-soft);
  color: var(--gold-ink);
  border: 1px solid var(--gold-ink);
  border-radius: var(--radius-pill);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green);
}

/* ==========================================================================
   OPÇÃO DE ESCOLHA (radio/checkbox visual)
   Selecionado NUNCA é comunicado só pela cor: há sempre o check à direita.
   ========================================================================== */

.choices {
  display: grid;
  gap: var(--sp-3);
}

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

/* Opções longas ocupam a linha inteira sem quebrar a grade */
.choices-2col .choice-wide { grid-column: 1 / -1; }

@media (max-width: 400px) {
  .choices-2col { grid-template-columns: 1fr; }
}

.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: 56px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-enter),
    background   var(--dur-fast) var(--ease-enter);
}

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

.choice-label { flex: 1; }

.choice-note {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* O check fica reservado no espaço mesmo invisível, para o texto não
   deslocar quando a opção é escolhida. */
.choice-check {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  color: transparent;
  transition: all var(--dur-fast) var(--ease-enter);
}

.choice[aria-checked="true"] {
  border-color: var(--gold-ink);
  border-width: 2px;
  background: var(--gold-soft);
}

.choice[aria-checked="true"] .choice-check {
  background: var(--gold-ink);
  border-color: var(--gold-ink);
  color: #FFFFFF;
}

/* ==========================================================================
   CAMPO DE TEXTO
   ========================================================================== */

.field { margin-bottom: var(--sp-4); }

.field-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}

.field-optional {
  font-weight: 400;
  color: var(--ink-muted);
}

.input,
.textarea {
  width: 100%;
  min-height: 52px;                /* alvo de toque */
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-size: var(--text-base);     /* 16px impede o zoom automático do iOS */
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-enter);
}

.textarea {
  min-height: 160px;
  line-height: var(--leading-body);
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder { color: #9C948C; }

.input:hover,
.textarea:hover { border-color: var(--ink-muted); }

.input:focus,
.textarea:focus {
  outline: 2px solid var(--gold-ink);
  outline-offset: 1px;
  border-color: var(--gold-ink);
}

.field-help {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-top: var(--sp-2);
}

/* Erro: borda vermelha + ícone + texto. Três sinais, não só a cor. */
.field.has-error .input,
.field.has-error .textarea { border-color: var(--danger); }

.field-error {
  display: none;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--danger);
  margin-top: var(--sp-2);
}

.field.has-error .field-error { display: flex; }

.field-error svg { flex: 0 0 18px; margin-top: 2px; }

/* Válido: check discreto à direita do campo */
.field.is-valid .input { border-color: var(--green); }

/* ==========================================================================
   BARRA DE PROGRESSO
   ========================================================================== */

.progress {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

/* Preenchimento em dourado escuro, não no dourado claro: contra o trilho o
   claro dava 1.85:1 e o avanço mal se percebia. */
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold-ink);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease-enter);
}

/* ==========================================================================
   DISCO DE VINIL
   O giro é controlado por animation-play-state, para o JS poder pausar
   junto com o áudio sem precisar de um temporizador paralelo.
   ========================================================================== */

.vinyl {
  position: relative;
  width: 200px;
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%,
      var(--gold) 0 16%,
      #1A1614   16% 18%,
      #221D1A   18% 100%);
  box-shadow: var(--shadow-lift), inset 0 0 40px rgba(0, 0, 0, .5);
  animation: vinyl-spin 4s linear infinite;
  animation-play-state: paused;
}

/* Sulcos do disco */
.vinyl::before {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, .05) 0 1px,
    transparent 1px 5px
  );
}

/* Furo central */
.vinyl::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--bg);
}

.vinyl.is-spinning { animation-play-state: running; }

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

@media (min-width: 768px) {
  .vinyl { width: 260px; }
}

/* Sem movimento: o disco existe, mas parado. */
@media (prefers-reduced-motion: reduce) {
  .vinyl, .vinyl.is-spinning { animation: none; }
}

/* ==========================================================================
   PLAYER DE ÁUDIO
   ========================================================================== */

.player {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.player-btn {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-enter),
              transform  var(--dur-fast) var(--ease-enter);
}
.player-btn:hover  { background: var(--gold-strong); }
.player-btn:active { transform: scale(.94); }

.player-btn-wine {
  background: var(--wine);
  color: var(--ink-invert);
}
.player-btn-wine:hover { background: var(--wine-deep); }

.player-btn svg { width: 22px; height: 22px; }

/* Barra clicável: a área de toque cresce por padding, mas o traço fica fino */
.player-track {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.player-track-rail {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.player-track-fill {
  height: 100%;
  width: 0;
  background: var(--wine);
  border-radius: var(--radius-pill);
}

.player-time {
  flex: 0 0 auto;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   WHATSAPP FLUTUANTE
   Canto inferior direito, acima do conteúdo mas nunca sobre a CTA:
   as telas do funil reservam espaço no rodapé.
   ========================================================================== */

.whatsapp-float {
  position: fixed;
  right: calc(var(--sp-4) + env(safe-area-inset-right));
  bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  z-index: var(--z-float);
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #FFFFFF;
  box-shadow: var(--shadow-float);
  transition: transform var(--dur-fast) var(--ease-enter);
}
.whatsapp-float:hover { transform: scale(1.06); }
.whatsapp-float svg { width: 30px; height: 30px; }

/* ==========================================================================
   TELAS
   Todas existem no HTML; só a ativa é exibida.
   ========================================================================== */

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in var(--dur-slow) var(--ease-enter); }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
