/* ==========================================================================
   NexusUI — componentes próprios do site (prefixo .nu-*)
   Carregue depois de nexus/nexus.css. Só tokens --nx-* (tema em assets/tema.css).
   Anima só transform, opacity, cores e o brilho (--nx-shadow-glow).
   ========================================================================== */

@layer nx-components {

  /* ---- Header ------------------------------------------------------------ */
  .nu-logo img { width: auto; height: 1.75rem; }
  .nu-footer-logo { width: auto; height: 2rem; }

  /* ---- Hero tela cheia --------------------------------------------------- */
  .nu-hero {
    display: grid;
    align-items: center;
    min-height: calc(100svh - var(--nx-header-h, 4.5rem));
    padding-block: var(--nx-space-10) var(--nx-space-20);
  }
  /* Brilho difuso atrás do símbolo. */
  .nu-hero::before {
    z-index: -2;
    background:
      radial-gradient(40% 45% at 70% 42%, var(--nx-glow), transparent 70%),
      radial-gradient(30% 35% at 18% 20%, var(--nx-brand-brilho-magenta), transparent 75%);
  }
  /* "Planeta" com horizonte brilhante no rodapé do hero. */
  .nu-hero::after {
    z-index: -2;
    inset: auto;
    left: -50%;
    right: -50%;
    top: 84%;
    height: 260%;
    border-radius: 50%;
    background: var(--nx-bg);
    background-image: none;
    -webkit-mask-image: none;
    mask-image: none;
    box-shadow:
      0 -1px 0 0 var(--nx-brand-aro),
      0 -14px 50px -14px var(--nx-brand-horizonte),
      0 -70px 160px -50px var(--nx-brand-brilho-ciano);
  }

  /* Tela estreita: o hero é alto e fino, então o "planeta" fica mais largo e mais baixo
     para a curva não subir por cima da nota e do botão de pausa. */
  @media (max-width: 59.99rem) {
    .nu-hero::after { left: -170%; right: -170%; top: 95%; height: 180%; }
  }

  .nu-hero__canvas {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    max-width: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--nx-dur-fast) var(--nx-ease-out);
  }
  .nu-hero[data-webgl="on"] .nu-hero__canvas { opacity: 1; }

  .nu-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--nx-space-6);
    align-items: center;
  }
  .nu-hero__stage {
    order: -1;
    display: grid;
    place-items: center;
    height: clamp(10rem, 30svh, 16rem);
  }
  .nu-hero__fallback {
    width: min(88%, 34rem);
    height: auto;
    transition: opacity var(--nx-dur-slow) var(--nx-ease-out);
  }
  /* Some rápido quando as partículas assumem, para a abertura começar do ponto de luz. */
  .nu-hero[data-webgl="on"] .nu-hero__fallback { opacity: 0; transition-duration: var(--nx-dur-fast); }

  .nu-hero__text {
    display: grid;
    gap: var(--nx-space-5);
    justify-items: center;
    text-align: center;
  }
  .nu-hero__text h1 { font-size: clamp(2rem, 1.3rem + 2.9vw, 3.6rem); max-width: 16ch; }
  .nu-hero__text .nx-lead { margin-inline: auto; }
  .nu-hero__text .nx-hero__actions { margin-top: var(--nx-space-1); }
  .nu-hero__pause { gap: var(--nx-space-2); font-size: var(--nx-text-sm); }
  .nu-hero__pause[hidden], .nu-hero__pause svg[hidden] { display: none; }

  @media (min-width: 60rem) {
    .nu-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--nx-space-8); }
    .nu-hero__stage { order: 0; height: min(62svh, 34rem); }
    .nu-hero__text { justify-items: start; text-align: left; }
    .nu-hero__text .nx-lead { margin-inline: 0; }
    .nu-hero__text .nx-hero__actions { justify-content: flex-start; }
    /* Botão fantasma: o texto alinha com a coluna (o preenchimento fica para fora). */
    .nu-hero__pause { margin-inline-start: calc(var(--nx-space-5) * -1); }
  }

  /* Altura baixa (celular deitado, zoom alto): o hero não força tela cheia. */
  @media (max-height: 30rem) {
    .nu-hero { min-height: 0; }
    .nu-hero__stage { height: 8rem; }
  }

  /* ---- Conceito: Linha Aurora com nós ---------------------------------- */
  .nu-linha { position: relative; --nu-p: 1; }
  .nu-linha__fio {
    position: absolute;
    top: 0.75rem;
    bottom: 0.75rem;
    left: 0.6875rem;
    width: 2px;
    border-radius: var(--nx-radius-full);
    background: var(--nx-border-strong);
  }
  .nu-linha__fio::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--nx-brand-aurora-v);
    transform: scaleY(var(--nu-p));
    transform-origin: top;
  }
  .nu-linha ol {
    position: relative;
    display: grid;
    gap: var(--nx-space-10);
    list-style: none;
    padding: 0;
  }
  .nu-linha li { position: relative; display: grid; gap: var(--nx-space-2); padding-left: var(--nx-space-12); }
  .nu-linha li p { color: var(--nx-text-secondary); }
  .nu-linha li:nth-child(1) { --nu-cor: var(--nx-brand-magenta); }
  .nu-linha li:nth-child(2) { --nu-cor: var(--nx-brand-violeta); }
  .nu-linha li:nth-child(3) { --nu-cor: var(--nx-brand-azul); }
  .nu-linha li:nth-child(4) { --nu-cor: var(--nx-brand-ciano); }
  .nu-linha__no {
    position: absolute;
    left: 0;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--nu-cor);
    border-radius: var(--nx-radius-full);
    background: var(--nx-bg);
    box-shadow: 0 0 0 4px var(--nx-bg), var(--nx-shadow-glow);
    transition: border-color var(--nx-dur-slow) var(--nx-ease-out),
                box-shadow var(--nx-dur-slow) var(--nx-ease-out);
  }
  .nu-linha__no::after {
    content: "";
    position: absolute;
    inset: 0.25rem;
    border-radius: inherit;
    background: var(--nu-cor);
    transition: transform var(--nx-dur-slow) var(--nx-ease-out),
                opacity var(--nx-dur-slow) var(--nx-ease-out);
  }
  /* Com o JS armado, os nós acendem quando a linha chega neles (o texto nunca some). */
  .nu-linha[data-armed] li:not(.is-on) .nu-linha__no { border-color: var(--nx-border-strong); box-shadow: 0 0 0 4px var(--nx-bg); }
  .nu-linha[data-armed] li:not(.is-on) .nu-linha__no::after { opacity: 0; transform: scale(0.2); }

  @media (min-width: 56rem) {
    .nu-linha__fio { top: 0.6875rem; bottom: auto; left: 0.75rem; right: 0.75rem; width: auto; height: 2px; }
    .nu-linha__fio::after { background: var(--nx-brand-aurora); transform: scaleX(var(--nu-p)); transform-origin: left; }
    .nu-linha ol { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--nx-space-8); }
    .nu-linha li { padding-left: 0; padding-top: var(--nx-space-12); }
  }

  /* ---- Soluções ---------------------------------------------------------- */
  .nu-solucao { position: relative; overflow: clip; }
  .nu-solucao::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: var(--nx-brand-aurora);
    opacity: 0.35;
    transition: opacity var(--nx-dur-base) var(--nx-ease-out);
  }
  .nu-solucao:hover::before { opacity: 1; }
  .nu-solucao ul { display: grid; gap: var(--nx-space-2); margin-top: var(--nx-space-2); padding-left: var(--nx-space-5); color: var(--nx-text-secondary); font-size: var(--nx-text-sm); }

  /* ---- Como funciona: 4 passos ------------------------------------------ */
  /* align-content: start — sem isso, o cartão de texto mais curto distribui a sobra de altura
     entre as linhas e o título desce alguns pixels em relação aos vizinhos. */
  .nu-steps > li { align-content: start; }
  @media (min-width: 40rem) { .nu-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (min-width: 64rem) { .nu-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

  /* ---- Cases -------------------------------------------------------------- */
  .nu-cases { display: grid; gap: var(--nx-space-6); }
  .nu-case {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--nx-space-8);
    padding: clamp(var(--nx-space-5), 3vw, var(--nx-space-10));
    border-radius: var(--nx-radius-xl);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  @media (min-width: 60rem) {
    .nu-case { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: center; }
  }
  .nu-case__body { display: grid; gap: var(--nx-space-4); align-content: start; justify-items: start; }
  .nu-case__body p { color: var(--nx-text-secondary); }
  .nu-case__media { position: relative; padding-bottom: var(--nx-space-8); padding-right: var(--nx-space-8); }
  .nu-case__desk, .nu-case__cel {
    border: 1px solid var(--nx-border-strong);
    background: var(--nx-surface);
  }
  .nu-case__desk { width: 100%; height: auto; border-radius: var(--nx-radius-md); }
  .nu-case__cel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 26%;
    height: auto;
    border-radius: var(--nx-radius-lg);
    box-shadow: 0 0 0 6px var(--nx-bg), var(--nx-shadow-glow);
  }
  .nu-tags { display: flex; flex-wrap: wrap; gap: var(--nx-space-2); list-style: none; padding: 0; }
  .nu-tags li {
    padding: var(--nx-space-1) var(--nx-space-3);
    border: 1px solid var(--nx-border-strong);
    border-radius: var(--nx-radius-full);
    font-size: var(--nx-text-xs);
    color: var(--nx-text-secondary);
  }
  .nu-case--breve { grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 60rem) { .nu-case--breve { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
  /* Grade de círculos (elemento da marca) no lugar de tela: nada de captura inventada. */
  .nu-grade {
    min-height: 9rem;
    border: 1px dashed var(--nx-border-control);
    border-radius: var(--nx-radius-lg);
    background-image:
      radial-gradient(circle at center, transparent 0 1.3rem, var(--nx-border-strong) 1.3rem calc(1.3rem + 1px), transparent calc(1.3rem + 1px));
    background-size: 3rem 3rem;
    background-position: center;
  }

  /* ---- Diferenciais ------------------------------------------------------ */
  .nu-dif .nx-icon-box { color: var(--nx-link); }
  /* Quatro cartões: 1 coluna → 2×2 → 4 numa linha (o auto-fit do kit deixava um cartão sozinho). */
  .nu-dif { grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 40rem) { .nu-dif { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (min-width: 72rem) { .nu-dif { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

  /* ---- Contato ----------------------------------------------------------- */
  .nu-contato-email { font-size: var(--nx-text-lg); font-weight: 500; overflow-wrap: anywhere; }
  .nu-contato .nx-select { appearance: auto; }
}
