/* Inctor — marca em movimento: o fundo "linha de base" e a entrada do Núcleo.
 *
 * Uma fonte só para o site e para as telas de entrada dos painéis; o
 * scripts/sync-shared-ui.mjs copia este arquivo e o brand-motion.js para
 * painel/ui/, painel-admin/ui/ e site/ui/. Não depende de tokens.css: o site
 * não carrega o kit.
 *
 * Cores: por padrão, Osso e Aço claro sobre Tinta (o site). Com a classe
 * .themed no <body>, seguem o tema do painel — Tinta e Aço sobre Osso no claro.
 */

:root {
  --motion-ink: #EFEBE3;   /* ângulos e blocos do Núcleo */
  --motion-line: #7D93A6;  /* traços do fundo */
  --motion-strength: 1;    /* opacidade do fundo inteiro */
}

/* no claro, Aço sobre Osso pesa mais que Aço claro sobre Tinta: o fundo baixa */
.themed {
  --motion-ink: #0C1824;
  --motion-line: #1F3A52;
  --motion-strength: .6;
}

:root[data-theme="dark"] .themed {
  --motion-ink: #EFEBE3;
  --motion-line: #7D93A6;
  --motion-strength: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themed {
    --motion-ink: #EFEBE3;
    --motion-line: #7D93A6;
    --motion-strength: 1;
  }
}

/* ------------------------------------------------------------ fundo */

/* Canvas fixo atrás do conteúdo (brand-motion.js desenha; a cor vem de `color`).
   Some nas bordas para o texto ficar sobre o fundo limpo. */
.backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  color: var(--motion-line);
  opacity: var(--motion-strength);
  -webkit-mask-image: radial-gradient(130% 95% at 50% 38%, #000 30%, transparent 88%);
  mask-image: radial-gradient(130% 95% at 50% 38%, #000 30%, transparent 88%);
}

/* ------------------------------------------------------------ Núcleo */

/* Entrada Núcleo (brand/animacao/entrada-escuro.svg e entrada-claro.svg), na
   folha de estilo porque a CSP bloqueia <style> embutido. 1,2 s por passada. As
   animações só valem dentro de .play: brand-motion.js tira e devolve a classe
   em todo [data-replay] para a entrada recomeçar quando a marca volta a ficar
   visível. */
.nx { display: block; height: auto; }
.nx-a1, .nx-a2, .nx-q1, .nx-q3, .nx-q4 { fill: var(--motion-ink); }
.nx-q2, .nx-core { fill: #C08A2E; }
.nx-fl { fill: #F2D9A4; }
.nx-set { transform-box: view-box; transform-origin: 64px 64px; }
.nx-nuc { transform-box: view-box; transform-origin: 64px 64px; }
.play .nx-set { animation: nx-sn 1.2s .3s both; }
.play .nx-a1 { animation: nx-e1 1.2s .3s both; }
.play .nx-a2 { animation: nx-e2 1.2s .3s both; }
.play .nx-nuc { animation: nx-gir 1.2s .3s both; }
.play .nx-q1 { animation: nx-cv1 1.2s .3s both, nx-vira 1.2s .3s both; }
.play .nx-q2 { animation: nx-cv2 1.2s .3s both; }
.play .nx-q3 { animation: nx-cv3 1.2s .3s both, nx-vira 1.2s .3s both; }
.play .nx-q4 { animation: nx-cv4 1.2s .3s both, nx-vira 1.2s .3s both; }
/* núcleo inteiro por trás dos quatro blocos: cobre a emenda depois do encaixe */
.nx-core { opacity: 0; }
.nx-fl { opacity: 0; }
.play .nx-core { animation: nx-core 1.2s .3s both; }
.play .nx-fl { animation: nx-fl 1.2s .3s both; }
/* fora de .play (antes do primeiro quadro, ou sem JavaScript): a marca montada */
.nx:not(.play .nx) .nx-q1,
.nx:not(.play .nx) .nx-q3,
.nx:not(.play .nx) .nx-q4 { fill: #C08A2E; }
.nx:not(.play .nx) .nx-core { opacity: 1; }

@keyframes nx-e1 {
  0% { transform: translate(-62px, -62px); opacity: 0; }
  8% { transform: translate(-62px, -62px); opacity: 0; animation-timing-function: cubic-bezier(.55, 0, .25, 1); }
  20% { opacity: 1; }
  65% { transform: translate(6px, 6px); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  82% { transform: translate(-1.5px, -1.5px); }
  100% { transform: translate(0, 0); opacity: 1; }
}
@keyframes nx-e2 {
  0% { transform: translate(62px, 62px); opacity: 0; }
  8% { transform: translate(62px, 62px); opacity: 0; animation-timing-function: cubic-bezier(.55, 0, .25, 1); }
  20% { opacity: 1; }
  65% { transform: translate(-6px, -6px); animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  82% { transform: translate(1.5px, 1.5px); }
  100% { transform: translate(0, 0); opacity: 1; }
}
@keyframes nx-cv1 { 0% { transform: translate(-8px, -8px); opacity: 0; animation-timing-function: cubic-bezier(.45, 0, .15, 1); } 10% { opacity: 1; } 65%, 100% { transform: translate(0, 0); opacity: 1; } }
@keyframes nx-cv2 { 0% { transform: translate(8px, -8px); opacity: 0; animation-timing-function: cubic-bezier(.45, 0, .15, 1); } 10% { opacity: 1; } 65%, 100% { transform: translate(0, 0); opacity: 1; } }
@keyframes nx-cv3 { 0% { transform: translate(-8px, 8px); opacity: 0; animation-timing-function: cubic-bezier(.45, 0, .15, 1); } 10% { opacity: 1; } 65%, 100% { transform: translate(0, 0); opacity: 1; } }
@keyframes nx-cv4 { 0% { transform: translate(8px, 8px); opacity: 0; animation-timing-function: cubic-bezier(.45, 0, .15, 1); } 10% { opacity: 1; } 65%, 100% { transform: translate(0, 0); opacity: 1; } }
@keyframes nx-vira { 0%, 25% { fill: var(--motion-ink); } 65%, 100% { fill: #C08A2E; } }
@keyframes nx-gir { 0% { transform: rotate(0); animation-timing-function: cubic-bezier(.45, 0, .15, 1); } 65%, 100% { transform: rotate(90deg); } }
@keyframes nx-core { 0%, 64% { opacity: 0; } 65%, 100% { opacity: 1; } }
@keyframes nx-fl { 0%, 62% { opacity: 0; } 68% { opacity: .95; } 90%, 100% { opacity: 0; } }
@keyframes nx-sn { 0%, 61% { transform: scale(1); } 70% { transform: scale(1.06); } 84% { transform: scale(.995); } 100% { transform: scale(1); } }

/* ------------------------------------------------------------ marca grande */

/* A marca no centro das telas de entrada: Núcleo grande e o nome embaixo. */
.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  color: var(--motion-ink);
  text-align: center;
}

.brand-mark .nx { width: clamp(6.5rem, 26vw, 9.5rem); }

.brand-mark__name {
  font-family: var(--font-display, "Archivo", system-ui, sans-serif);
  font-weight: 700;
  font-variation-settings: "wdth" 112;
  letter-spacing: -0.03em;
  font-size: 2rem;
  line-height: 1;
}

.brand-mark__surface {
  color: var(--text-muted, #7D93A6);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------ movimento reduzido */

/* marca estática: os quatro blocos já montados em Latão, sem estalo */
@media (prefers-reduced-motion: reduce) {
  .nx-set, .nx-a1, .nx-a2, .nx-nuc, .nx-q1, .nx-q2, .nx-q3, .nx-q4, .nx-core, .nx-fl { animation: none !important; }
  .nx-q1, .nx-q3, .nx-q4 { fill: #C08A2E; }
  .nx-core { opacity: 1; }
  .nx-fl { display: none; }
}
