/* ESTRADÃO — Animações e microanimações levíssimas
   Regras:
   - Usa tokens de estilo.css (--t-toque, --t-entra, --t-folha, --curva, --marca, --ambar, --verde, --perigo).
   - Só anima transform e opacity (100% GPU, sem layout thrashing).
   - Interações até 300 ms.
   - Respeita prefers-reduced-motion e silencia distrações quando o caminhão está em movimento (.em-movimento). */

/* === 1. BASE DE ÍCONE SVG SPRITE === */
.ic {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
  color: inherit;
  pointer-events: none;
}
.ic-16 { width: 16px; height: 16px; }
.ic-18 { width: 18px; height: 18px; }
.ic-22 { width: 22px; height: 22px; }
.ic-24 { width: 24px; height: 24px; }
.ic-28 { width: 28px; height: 28px; }

/* === 2. FEEDBACK TÁTIL EM BOTÕES === */
.arte-toque {
  transition: transform var(--t-toque, 120ms) var(--curva, cubic-bezier(.2,.8,.2,1)),
              opacity var(--t-toque, 120ms) var(--curva, cubic-bezier(.2,.8,.2,1));
  will-change: transform;
}
.arte-toque:active {
  transform: scale(0.94);
}

/* === 3. CURTIR / APOIAR NO FEED === */
@keyframes arte-curtir-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.24); }
  100% { transform: scale(1); }
}
@keyframes arte-anel {
  0%   { transform: scale(0.55); opacity: 0.75; }
  100% { transform: scale(1.75); opacity: 0; }
}
.arte-curtir {
  position: relative;
}
.arte-curtir.ativo .ic {
  animation: arte-curtir-pop 260ms var(--curva, cubic-bezier(.2,.8,.2,1));
}
.arte-curtir.ativo::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  border: 2px solid var(--marca, #FFC400);
  pointer-events: none;
  animation: arte-anel 280ms var(--curva, cubic-bezier(.2,.8,.2,1)) forwards;
}

/* === 4. AVISO FLUTUANTE DE XP (+50 XP) === */
@keyframes arte-xp-entra {
  0%   { opacity: 0; transform: translateY(10px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes arte-xp-sai {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(0.96); }
}
.arte-xp-entra {
  animation: arte-xp-entra var(--t-entra, 220ms) var(--curva, cubic-bezier(.2,.8,.2,1)) both;
}
.arte-xp-sai {
  animation: arte-xp-sai var(--t-entra, 220ms) var(--curva, cubic-bezier(.2,.8,.2,1)) both;
}

/* === 5. SUBIDA DE NÍVEL (SO COM CAMINHÃO PARADO) === */
@keyframes arte-nivel-pop {
  0%   { opacity: 0; transform: scale(0.82); }
  70%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes arte-onda-nivel {
  0%   { transform: scale(0.8); opacity: 0.7; }
  100% { transform: scale(1.65); opacity: 0; }
}
.arte-nivel-selo {
  position: relative;
  animation: arte-nivel-pop 280ms var(--curva, cubic-bezier(.2,.8,.2,1)) both;
}
.arte-nivel-selo::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid var(--ambar, #FF8A1F);
  pointer-events: none;
  animation: arte-onda-nivel 300ms var(--curva, cubic-bezier(.2,.8,.2,1)) forwards;
}

/* === 6. MEDALHA CONQUISTADA === */
@keyframes arte-medalha-ganha {
  0%   { opacity: 0.3; transform: scale(0.85); }
  65%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
.arte-medalha {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
}
.arte-medalha.recem-ganha {
  animation: arte-medalha-ganha 280ms var(--curva, cubic-bezier(.2,.8,.2,1)) both;
}

/* === 7. BARRA DE PROGRESSO (XP E MISSÕES) === */
.arte-barra-trilha {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
}
.arte-barra-fill {
  transform-origin: left center;
  transition: transform 280ms var(--curva, cubic-bezier(.2,.8,.2,1));
  will-change: transform;
}

/* === 8. FOLHAS (BOTTOM SHEET) E TROCA DE ABAS === */
@keyframes arte-folha-sobe {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}
.arte-folha-entra {
  animation: arte-folha-sobe var(--t-folha, 280ms) var(--curva, cubic-bezier(.2,.8,.2,1)) both;
}
.arte-aba-ind {
  transition: transform var(--t-entra, 220ms) var(--curva, cubic-bezier(.2,.8,.2,1));
  will-change: transform;
}

/* === 9. CHAT DE VOZ (GRAVANDO) === */
@keyframes arte-pulso-voz {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}
.arte-voz-ponto {
  animation: arte-pulso-voz 300ms var(--curva, cubic-bezier(.2,.8,.2,1)) infinite alternate;
}

/* === 10. ALERTA NA PISTA (RADAR SUTIL) === */
@keyframes arte-alerta-pulso {
  0%   { transform: scale(0.95); opacity: 0.85; }
  100% { transform: scale(1.45); opacity: 0; }
}
.arte-alerta-ring {
  position: relative;
}
.arte-alerta-ring::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid var(--perigo, #FF3B30);
  pointer-events: none;
  animation: arte-alerta-pulso 300ms var(--curva, cubic-bezier(.2,.8,.2,1)) 2;
}

/* === 11. MOLDURA DE PERFIL SOCIAL (SOBREPOSTA AO AVATAR) === */
.arte-avatar-box {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.arte-avatar-box > img.avatar-foto {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  object-fit: cover;
}
.arte-avatar-box > img.avatar-moldura {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* === 12. SKELETON ESCURO LEVÍSSIMO === */
@keyframes arte-esqueleto {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.arte-esqueleto {
  position: relative;
  overflow: hidden;
  background: var(--sup-1, #17191D);
}
.arte-esqueleto::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: arte-esqueleto 300ms linear infinite;
}

/* === 13. SEGURANÇA AO VOLANTE E ACESSIBILIDADE === */
#app.em-movimento .arte-nivel-selo,
#app.em-movimento .arte-nivel-selo::after,
#app.em-movimento .arte-medalha.recem-ganha,
#app.em-movimento .arte-curtir.ativo::after,
#app.em-movimento .arte-alerta-ring::after {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .arte-toque,
  .arte-barra-fill,
  .arte-aba-ind {
    transition: none !important;
  }
  .arte-curtir.ativo .ic,
  .arte-curtir.ativo::after,
  .arte-xp-entra,
  .arte-xp-sai,
  .arte-nivel-selo,
  .arte-nivel-selo::after,
  .arte-medalha.recem-ganha,
  .arte-folha-entra,
  .arte-voz-ponto,
  .arte-alerta-ring::after,
  .arte-esqueleto::after {
    animation: none !important;
  }
}
