/*
 * Tripulantes · tela de carregamento (spinner "luma"). Prefixo tk-. Só tokens de tokens.css.
 * Duas linhas que giram pelos cantos de um quadrado de 65 px, na cor do texto (escura no claro, clara no escuro).
 */
.tk-luma { position: relative; width: 65px; aspect-ratio: 1; flex: none; }
.tk-luma span { position: absolute; border-radius: 50px; box-shadow: inset 0 0 0 3px var(--tinta, #1f2937); animation: tk-luma 2.5s infinite; }
.tk-luma span + span { animation-delay: -1.25s; }
@keyframes tk-luma {
  0%    { inset: 0 35px 35px 0; }
  12.5% { inset: 0 35px 0 0; }
  25%   { inset: 35px 35px 0 0; }
  37.5% { inset: 35px 0 0 0; }
  50%   { inset: 35px 0 0 35px; }
  62.5% { inset: 0 0 0 35px; }
  75%   { inset: 0 0 35px 35px; }
  87.5% { inset: 0 0 35px 0; }
  100%  { inset: 0 35px 35px 0; }
}
.tk-luma-p { width: 32px; } /* versão pequena, para dentro de cartões */
.tk-luma-p span { box-shadow: inset 0 0 0 2px var(--tinta, #1f2937); }
.tk-luma-p span { animation-name: tk-luma-p; }
@keyframes tk-luma-p {
  0% { inset: 0 17px 17px 0; } 12.5% { inset: 0 17px 0 0; } 25% { inset: 17px 17px 0 0; } 37.5% { inset: 17px 0 0 0; }
  50% { inset: 17px 0 0 17px; } 62.5% { inset: 0 0 0 17px; } 75% { inset: 0 0 17px 17px; } 87.5% { inset: 0 0 17px 0; } 100% { inset: 0 17px 17px 0; }
}

/* Cobertura: tela inteira (ao abrir o sistema) ou só a área da tela (ao trocar de menu) */
.tk-cobre { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  min-height: 260px; background: var(--superficie, #fff); color: var(--tinta-suave, #6b7280); font: 500 13px/18px var(--font-texto, system-ui, sans-serif);
  opacity: 0; animation: tk-entra 200ms ease forwards; }
.tk-cobre.tk-sai { animation: tk-sai 220ms ease forwards; }
.tk-inteira { position: fixed; z-index: 9999; min-height: 0; }
.tk-area { position: relative; min-height: 320px; }
.tk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes tk-entra { to { opacity: 1; } }
@keyframes tk-sai { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }

/* Enquanto carrega, o conteúdo antigo da área NUNCA aparece por baixo */
.tk-area > :not(.tk-cobre) { visibility: hidden; }
.tk-mostra { animation: tk-mostra 260ms ease both; }
@keyframes tk-mostra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Abertura do sistema: cole no <head> como CSS (antes de qualquer script) */
html.tk-iniciando body > :not(.tk-cobre) { visibility: hidden !important; }

@media (prefers-reduced-motion: reduce) {
  .tk-luma span { animation-duration: 5s; }
  .tk-cobre, .tk-mostra { animation-duration: 1ms; }
}
.tk-erro { margin: 48px auto; max-width: 420px; padding: 12px 16px; border-radius: var(--raio-sm, 8px); background: var(--erro-fundo, #fde3df); color: var(--erro, #b03426); font: 500 14px/20px var(--font-texto, system-ui); text-align: center; }

/* ===== Animação da MPD: os cubos se montam e se desmontam (substitui o spinner antigo) ===== */
.tk-anim { position: relative; width: 72px; height: 80px; display: grid; place-items: center; flex: none; }
.tk-anim-p { width: 34px; height: 38px; }
.tk-mpd { width: 100%; height: 100%; overflow: visible; }
.tk-mpd path { transform-box: view-box; animation: tk-monta 1.8s cubic-bezier(.34, 1.4, .64, 1) infinite; }
.tk-mpd .tk-c1 { animation-delay: 0s; }
.tk-mpd .tk-c2 { animation-delay: .14s; }
.tk-mpd .tk-c3 { animation-delay: .28s; }
.tk-sombra { position: absolute; bottom: -4px; left: 50%; width: 60%; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, .28); transform: translateX(-50%); animation: tk-sombra 1.8s ease-in-out infinite; }
[data-theme="dark"] .tk-sombra { background: rgba(0, 0, 0, .5); }
.tk-anim-p .tk-sombra { height: 3px; bottom: -2px; }
@keyframes tk-monta {
  0% { transform: translateY(-120px); opacity: 0; }
  22% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(0); opacity: 1; }
  86% { transform: translateY(16px) scale(.96); opacity: 0; }
  100% { transform: translateY(-120px); opacity: 0; }
}
@keyframes tk-sombra { 0%, 100% { opacity: .2; width: 30%; } 25%, 70% { opacity: 1; width: 62%; } }
@media (prefers-reduced-motion: reduce) {
  .tk-mpd path { animation: tk-pulsa 1.6s ease-in-out infinite; }
  .tk-sombra { animation: none; }
  @keyframes tk-pulsa { 50% { opacity: .5; } }
}
