/* Formulário: chamada na montanha -> painel com nome, e-mail e WhatsApp -> tela final de confirmação. */

/* ---------- Tela 1: chamada ---------- */

.inicio {
  position: absolute;
  inset: 0;
  background:
    var(--montanhas) bottom / 100% 64px no-repeat,
    radial-gradient(circle at 88% 12%, var(--floresta-clara), var(--floresta) 55%, var(--floresta-escura));
  cursor: pointer;
}

.cenario {
  position: absolute;
  width: 100%;
  height: 100%;
}

.estrelas circle {
  animation: piscar 2.4s ease-in-out infinite;
}

.estrelas circle:nth-child(2n) {
  animation-delay: 0.8s;
}

.estrelas circle:nth-child(3n) {
  animation-delay: 1.6s;
}

/* Logo fincado no pico, balançando como bandeira */
.bandeira {
  position: absolute;
  left: 236px;
  top: 63px;
  width: 30px;
  transform-origin: 0 50%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  animation: tremular 2.2s ease-in-out infinite alternate;
}

.topo {
  position: absolute;
  left: 12px;
  top: 12px;
}

.chamada {
  position: absolute;
  left: 14px;
  top: 58px;
}

.chamada > * {
  animation: surgir 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s backwards;
}

.titulo {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.titulo em {
  font-style: normal;
  color: var(--verde-vivo);
}

.texto {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--verde-claro);
  animation-delay: 0.25s;
}

/* Botão pulsa um anel verde para chamar o clique (para em 30s com .parado) */
.abrir {
  margin-top: 14px;
  padding: 10px 18px;
  font-size: 13px;
  animation:
    surgir 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s backwards,
    chamar 2s ease-out 1.2s infinite;
}

.anuncio :focus-visible:not(input) {
  outline: 2px solid var(--verde-vivo);
  outline-offset: 2px;
}

/* ---------- Tela 2: painel do formulário ---------- */

.painel {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: radial-gradient(circle at 50% 0, var(--floresta-clara), var(--floresta) 70%);
  transform: translateY(100%);
  visibility: hidden;
  transition:
    transform 0.4s cubic-bezier(0.6, 0, 0.3, 1),
    visibility 0s 0.4s;
}

.aberto .painel {
  transform: none;
  visibility: visible;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.formulario {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 11px 16px 12px;
}

.aberto .formulario > * {
  animation: surgir 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s backwards;
}

.painel-topo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 800;
}

.painel-topo img {
  width: 22px;
}

/* × desenhado com duas barrinhas */
.fechar {
  position: relative;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.fechar:hover {
  background: rgba(255, 255, 255, 0.24);
}

.fechar::before,
.fechar::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 11px;
  width: 10px;
  height: 2px;
  background: var(--branco);
  transform: rotate(45deg);
}

.fechar::after {
  transform: rotate(-45deg);
}

/* Rótulo com a mensagem de erro à direita (fica no nome acessível do campo) */
.campo label {
  display: flex;
  justify-content: space-between;
  margin: 6px 0 2px;
  font-size: 10px;
  font-weight: 600;
  line-height: 13px;
  color: var(--verde-claro);
}

.erro {
  color: var(--erro);
}

/* 16px no campo evita o zoom automático do iOS ao focar */
.campo input {
  display: block;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border: 2px solid transparent;
  border-radius: 8px;
  outline: 0;
  font: 500 16px var(--texto);
  color: var(--floresta);
  background: var(--branco);
  user-select: text;
  -webkit-user-select: text;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.campo input::placeholder {
  color: #8c9c9b;
}

.campo input:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(82, 181, 90, 0.35);
}

.campo.invalido input {
  border-color: var(--erro);
}

.campo.invalido input:focus {
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.35);
}

.tremer input {
  animation: tremer 0.4s;
}

/* Erro de envio (rede); o espaço fica reservado para nada pular */
.aviso {
  min-height: 13px;
  margin: 3px 0 2px;
  font-size: 10px;
  font-weight: 600;
  line-height: 13px;
  text-align: center;
  color: var(--erro);
}

.enviar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 32px;
  margin-top: auto;
  font-size: 13px;
}

/* Enviando: uma barra mais clara enche o botão (uma vez só, sem loop) */
.enviando .enviar {
  cursor: progress;
}

.enviando .enviar::after {
  display: none;
}

.enviando .enviar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--verde-vivo);
  z-index: -1;
  animation: encher 8s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}

/* ---------- Tela 3: confirmação (base .final) com selo de check ---------- */

.final-selo {
  position: relative;
}

.final-logo {
  display: block;
}

.selo-check {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 24px;
  height: 24px;
  border: 2px solid var(--floresta);
  border-radius: 50%;
  background: var(--verde);
}

.selo-check::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid var(--floresta);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.fim .selo-check {
  animation: surgir-logo 0.4s 0.6s backwards;
}

@keyframes piscar {
  50% {
    opacity: 0.2;
  }
}

@keyframes tremular {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}

@keyframes chamar {
  from {
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.3),
      0 0 0 0 rgba(82, 181, 90, 0.6);
  }
  70%,
  to {
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.3),
      0 0 0 10px rgba(82, 181, 90, 0);
  }
}

@keyframes encher {
  to {
    width: 92%;
  }
}
