/* ================================================================
   AQF STUDIO — ORDEM 021, FRENTE E — fx-021 (chip de sucesso)
   Arquivo NOVO — acompanha js/fx-021.js. NÃO edita app.css.
   Carregar DEPOIS de css/app.css (ver INTEGRACAO-E.md).

   O chip é um selo leve e não bloqueante: pointer-events:none,
   some sozinho, nunca empilha. Nenhuma animação individual passa
   de 500 ms; a entrada dura 240 ms, o anel 480 ms, a saída 200 ms.
   No modo clean o chip é estático e plano. Com movimento reduzido
   (data-movimento="reduzido", prefers-reduced-motion ou
   data-animacao="0") TODA animação morre aqui — cinto de segurança
   em três camadas, no mesmo padrão da trava final de app.css.
   Tokens com fallback: o harness isolado não carrega tokens.css.
   ================================================================ */

/* Camada do chip: por cima do conteúdo (acima do confete, z 80),
   sem interceptar clique nem rolagem. */
#fx021-camada {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
}

/* Chip: selo pill com ✓ + texto. Posição inline (perto do botão
   clicado) ou .fx021-chip--base (centro inferior, fallback). */
.fx021-chip {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 16px 10px 10px;
  border-radius: 999px;
  background: rgba(16, 26, 46, 0.94);
  border: 1px solid rgba(45, 212, 191, 0.45);
  color: var(--texto, #F2F6FC);
  font-family: var(--font-corpo, 'Public Sans', system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.3;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: fx021-entrar 240ms ease-out both;
  z-index: 91;
}
.fx021-chip--base {
  left: 50%;
  bottom: 24px;
  top: auto;
  transform: translateX(-50%);
  animation-name: fx021-entrar-base;
}

.fx021-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--menta, #2DD4BF);
  color: var(--menta-ink, #052E28);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.fx021-texto {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Saída: fade curto de 200 ms (só quando há movimento). */
.fx021-chip.fx021-saindo {
  animation: fx021-sair 200ms ease-in forwards;
}

/* ---------- Modos ---------- */
/* CLEAN: mínimo — plano, sem sombra, sem brilho, sem movimento. */
.fx021-chip--clean {
  background: rgba(16, 26, 46, 0.96);
  border-color: rgba(159, 176, 200, 0.35);
  box-shadow: none;
  animation: none;
}
/* CINEMATIC: pleno — brilho menta/violeta ao redor do selo. */
.fx021-chip--cinematic {
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35),
    0 0 32px rgba(45, 212, 191, 0.35),
    0 12px 32px rgba(0, 0, 0, 0.5);
}
/* Sem movimento: aparece parado (a remoção também é sem fade —
   o JS pula a classe de saída nesse caso). */
.fx021-chip--estatico {
  animation: none;
}

/* Anel de luz na origem — SÓ cinematic com movimento (o JS só o
   cria nesse caso; o CSS aqui só define o desenho). */
.fx021-anel {
  position: fixed;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 2px solid var(--fx021-cor, #2DD4BF);
  pointer-events: none;
  animation: fx021-anel 480ms ease-out forwards;
  z-index: 90;
}

/* ---------- Keyframes (todas <= 500 ms) ---------- */
@keyframes fx021-entrar {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fx021-entrar-base {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes fx021-sair {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fx021-anel {
  from { opacity: 0.8; transform: scale(0.3); }
  to { opacity: 0; transform: scale(1.15); }
}

/* ---------- Trava final: movimento reduzido / animação 0 ----------
   Três camadas (mesmo padrão de app.css): atributo do <html>,
   classes aplicadas por prefs.aplicar() e a media query do SO. */
html[data-movimento="reduzido"] .fx021-chip,
html[data-movimento="reduzido"] .fx021-anel,
html.movimento-reduzido .fx021-chip,
html.movimento-reduzido .fx021-anel,
html.animacao-zero .fx021-chip,
html.animacao-zero .fx021-anel,
html[data-animacao="0"] .fx021-chip,
html[data-animacao="0"] .fx021-anel {
  animation: none !important;
}
html[data-movimento="reduzido"] .fx021-anel,
html.movimento-reduzido .fx021-anel,
html.animacao-zero .fx021-anel,
html[data-animacao="0"] .fx021-anel {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .fx021-chip,
  .fx021-anel {
    animation: none !important;
  }
  .fx021-anel {
    display: none !important;
  }
}

/* Mobile estreito: texto menor, selo mais compacto. */
@media (max-width: 560px) {
  .fx021-chip {
    font-size: 13px;
    padding: 9px 14px 9px 9px;
  }
}
