/* ==========================================================================
   INSTITUTO NEXEN — CAMADA DE ESTILO EXTRA  (v2 · mais movimento)
   Acabamento editorial: ouro, textura, molduras e animações.
   Funciona sobre o CSS existente (Tailwind) sem alterar o HTML.
   Claro e escuro (.dark) já são tratados.

   COMO AJUSTAR A VELOCIDADE: procure por "ajuste" nos comentários.
   ========================================================================== */

/* ---------- 1. Variáveis (ajuste aqui) -------------------------------- */
:root {
  /* Usa o --color-gold do projeto se existir; senão cai no dourado abaixo */
  --nx-gold: var(--color-gold, #d4a259);
  --nx-gold-2: color-mix(in srgb, var(--nx-gold) 55%, #ffffff);
  --nx-tint: color-mix(in srgb, var(--nx-gold) 8%, transparent);
  --nx-line: color-mix(in srgb, currentColor 14%, transparent);
  --nx-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --nx-shadow: 0 30px 60px -32px rgba(10, 14, 30, 0.35);
}
.dark {
  --nx-shadow: 0 34px 70px -30px rgba(0, 0, 0, 0.8);
}

/* ---------- 2. Base --------------------------------------------------- */
html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--nx-gold) transparent;
}
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip; /* evita rolagem lateral pelas molduras; não quebra o header sticky */
}
::selection {
  background: var(--nx-gold);
  color: #111;
}
:focus-visible {
  outline: 2px solid var(--nx-gold);
  outline-offset: 3px;
}

/* Grão sutil por cima da página (textura de papel) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- 3. Transição suave ENTRE páginas (Chrome/Edge/Safari novos) -- */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: 0.3s ease both nx-page-out;
}
::view-transition-new(root) {
  animation: 0.6s var(--nx-ease) both nx-page-in;
}
@keyframes nx-page-out {
  to { opacity: 0; transform: translateY(-10px); }
}
@keyframes nx-page-in {
  from { opacity: 0; transform: translateY(14px); }
}

/* ---------- 4. Barra de progresso + header que "acorda" ao rolar ------- */
@supports (animation-timeline: scroll()) {
  body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 70;
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--nx-gold), var(--nx-gold-2));
    animation: nx-progress linear both;
    animation-timeline: scroll(root);
  }
  header.sticky {
    animation: nx-header linear both;
    animation-timeline: scroll(root);
    animation-range: 0 160px;
  }
  @keyframes nx-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
  @keyframes nx-header {
    to {
      box-shadow: 0 1px 0 var(--nx-line), 0 18px 40px -28px rgba(0, 0, 0, 0.55);
    }
  }
}

/* Menu: sublinhado dourado que cresce ao passar o mouse */
header nav a:not(.active)::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 2px;
  height: 1px;
  background: var(--nx-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--nx-ease);
}
header nav a:not(.active):hover::after {
  transform: scaleX(1);
}

/* ---------- 5. Tipografia -------------------------------------------- */
/* Destaques em itálico viram ouro com brilho que corre */
main h1 em,
main h2 em {
  background: linear-gradient(100deg, var(--nx-gold) 10%, var(--nx-gold-2) 45%, var(--nx-gold) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding-inline: 0.06em; /* evita cortar a ponta do itálico */
  animation: nx-shine 6s linear infinite; /* ajuste: menor = mais rápido */
}
@keyframes nx-shine {
  to { background-position: -200% 0; }
}

/* Kicker (rótulo pequeno) com filete dourado que se desenha */
main .kicker:not(article .kicker) {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.8rem;
}
main .kicker:not(article .kicker)::before {
  content: "";
  flex: none;
  width: 2rem;
  height: 1px;
  background: var(--nx-gold);
  transform-origin: left;
}
@supports (animation-timeline: view()) {
  main .kicker:not(article .kicker)::before {
    animation: nx-line linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }
}
@supports not (animation-timeline: view()) {
  main .kicker:not(article .kicker)::before {
    animation: nx-line 1.1s var(--nx-ease) 0.3s both;
  }
}
@keyframes nx-line {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Citações: linha dourada na lateral */
main p.font-serif.italic {
  padding-left: 1.25rem;
  border-left: 2px solid var(--nx-gold);
}

/* ---------- 6. HERO: entrada em cascata ao carregar (todos os navegadores) -- */
@keyframes nx-up {
  from { opacity: 0; translate: 0 28px; filter: blur(6px); }
  to   { opacity: 1; translate: 0 0;    filter: blur(0); }
}
@keyframes nx-img-in {
  from { opacity: 0; scale: 0.9; translate: 0 36px; filter: blur(12px); }
  to   { opacity: 1; scale: 1;   translate: 0 0;    filter: blur(0); }
}
main > section:first-of-type .kicker { animation: nx-up 0.9s var(--nx-ease) 0.05s both; }
main > section:first-of-type h1      { animation: nx-up 1s   var(--nx-ease) 0.2s  both; }
main > section:first-of-type h1 + p  { animation: nx-up 1s   var(--nx-ease) 0.4s  both; }
main > section:first-of-type h1 + p + div { animation: nx-up 1s var(--nx-ease) 0.6s both; }
/* três blocos 01/02/03 que ficam sob o hero da home */
main > section:first-of-type .mt-16 > * {
  animation: nx-up 0.9s var(--nx-ease) both;
}
main > section:first-of-type .mt-16 > *:nth-child(1) { animation-delay: 0.75s; }
main > section:first-of-type .mt-16 > *:nth-child(2) { animation-delay: 0.9s; }
main > section:first-of-type .mt-16 > *:nth-child(3) { animation-delay: 1.05s; }
main > section:first-of-type img {
  animation: nx-img-in 1.3s var(--nx-ease) 0.35s both;
}

/* ---------- 7. HERO: brilho flutuante + malha em movimento ------------ */
main > section:first-of-type {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
main > section:first-of-type::before {
  content: "";
  position: absolute;
  top: -25%;
  right: -12%;
  z-index: -1;
  width: min(60vw, 900px);
  aspect-ratio: 1;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--nx-gold) 26%, transparent), transparent 70%);
  filter: blur(10px);
  animation: nx-float 12s ease-in-out infinite alternate; /* ajuste: menor = mais rápido */
}
main > section:first-of-type::after {
  content: "";
  position: absolute;
  inset: -64px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    linear-gradient(to right, color-mix(in srgb, currentColor 7%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, currentColor 7%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 75% 35%, #000, transparent 70%);
  mask-image: radial-gradient(ellipse at 75% 35%, #000, transparent 70%);
  animation: nx-grid 14s linear infinite;
}
@keyframes nx-float {
  to { transform: translate3d(-8%, 10%, 0) scale(1.12); }
}
@keyframes nx-grid {
  to { translate: 64px 64px; } /* o período da malha é 64px: loop sem emenda */
}

/* ---------- 8. Imagens: sombra, moldura, brilho e movimento ----------- */
main img {
  box-shadow: var(--nx-shadow);
  transition: transform 0.7s var(--nx-ease), box-shadow 0.7s var(--nx-ease);
}
main img:hover {
  transform: translateY(-6px) scale(1.015);
}
@media (min-width: 1024px) {
  main img {
    outline: 1px solid color-mix(in srgb, var(--nx-gold) 60%, transparent);
    outline-offset: 14px;
  }
}
@keyframes nx-img-float {
  from { translate: 0 0; }
  to   { translate: 0 -12px; }
}
@keyframes nx-parallax {
  from { translate: 0 28px; }
  to   { translate: 0 -28px; }
}
@keyframes nx-img-reveal {
  from { opacity: 0; scale: 0.93; filter: blur(8px); }
  to   { opacity: 1; scale: 1;    filter: blur(0); }
}

/* Navegadores SEM animação por rolagem: imagens flutuam suavemente */
@supports not (animation-timeline: view()) {
  main img {
    animation: nx-img-float 6s ease-in-out infinite alternate;
  }
  main > section:first-of-type img {
    animation: nx-img-in 1.3s var(--nx-ease) 0.35s both,
               nx-img-float 6s ease-in-out 1.7s infinite alternate;
  }
}
/* Navegadores COM animação por rolagem: parallax (a imagem desliza ao rolar) */
@supports (animation-timeline: view()) {
  main section:not(:first-of-type) img {
    animation: nx-img-reveal linear both, nx-parallax linear both;
    animation-timeline: view(), view();
    animation-range: entry 0% entry 55%, cover 0% cover 100%;
  }
  main > section:first-of-type img {
    animation: nx-img-in 1.3s var(--nx-ease) 0.35s both, nx-parallax linear both;
    animation-timeline: auto, view();
    animation-range: normal, cover 0% cover 100%;
  }
}

/* ---------- 9. Cartões: barra dourada, brilho de canto e elevação ----- */
main article,
main a.block.h-full,
main .grid > .border.bg-background {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.45s var(--nx-ease), box-shadow 0.45s var(--nx-ease),
    border-color 0.3s, background-color 0.3s;
}
main article::before,
main a.block.h-full::before,
main .grid > .border.bg-background::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--nx-gold), var(--nx-gold-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--nx-ease);
}
main article::after,
main a.block.h-full::after,
main .grid > .border.bg-background::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -40%;
  z-index: -1;
  width: 80%;
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--nx-gold) 20%, transparent), transparent);
  transition: opacity 0.5s;
}
main article:hover,
main a.block.h-full:hover,
main .grid > .border.bg-background:hover {
  transform: translateY(-6px);
  box-shadow: var(--nx-shadow);
  border-color: color-mix(in srgb, var(--nx-gold) 55%, transparent);
}
main article:hover::before,
main a.block.h-full:hover::before,
main .grid > .border.bg-background:hover::before {
  transform: scaleX(1);
}
main article:hover::after,
main a.block.h-full:hover::after,
main .grid > .border.bg-background:hover::after {
  opacity: 1;
}

/* Ícones dos cartões "dançam" ao passar o mouse */
main :is(article, .grid > .bg-background, .grid > .border) svg:not(a svg) {
  transition: transform 0.5s var(--nx-ease);
}
main :is(article, .grid > .bg-background, .grid > .border):hover svg:not(a svg):not(.lucide-arrow-right) {
  transform: translateY(-4px) scale(1.15) rotate(-6deg);
}

/* Números 01 / 02 / 03 sobem e crescem no hover */
main span.font-serif.italic {
  display: inline-block;
  transition: translate 0.45s var(--nx-ease), scale 0.45s var(--nx-ease);
}
main .bg-background:hover span.font-serif.italic {
  translate: 0 -4px;
  scale: 1.12;
}

/* Grades "gap-px": realce suave ao passar o mouse */
main .bg-border > .bg-background {
  transition: background-image 0.35s;
}
main .bg-border > .bg-background:hover {
  background-image: linear-gradient(var(--nx-tint), var(--nx-tint));
}

/* Setas do "Passo a passo": ficam empurrando para a frente */
@keyframes nx-arrow {
  0%, 100% { translate: 0 0; }
  50%      { translate: 8px 0; }
}
main svg.lucide-arrow-right.text-gold {
  animation: nx-arrow 1.6s ease-in-out infinite;
}

/* ---------- 10. Botões: brilho, halo, pulso e seta viva --------------- */
main a.inline-flex.group:not([class*="border-b"]) {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--nx-ease), box-shadow 0.35s var(--nx-ease),
    background-color 0.3s, color 0.3s, border-color 0.3s;
}
main a.inline-flex.group:not([class*="border-b"])::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.8s var(--nx-ease);
}
main a.inline-flex.group:not([class*="border-b"]):hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--nx-gold) 75%, transparent);
}
main a.inline-flex.group:not([class*="border-b"]):hover::after {
  transform: translateX(120%);
}
/* O botão principal do topo "respira" (anel dourado que pulsa) */
@keyframes nx-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--nx-gold) 55%, transparent); }
  70%  { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
main > section:first-of-type a.inline-flex.group {
  animation: nx-pulse 2.8s ease-out 2s infinite;
}
main > section:first-of-type a.inline-flex.group:hover {
  animation: none;
}
/* Seta dos botões pulsa de leve, e some o pulso quando o mouse chega */
@keyframes nx-beat {
  0%, 100% { scale: 1; }
  50%      { scale: 1.25; }
}
main a.inline-flex.group svg.lucide-arrow-up-right {
  animation: nx-beat 2.4s ease-in-out infinite;
}
main a.inline-flex.group:hover svg.lucide-arrow-up-right {
  animation: none;
}

/* ---------- 11. Seções com fundo ------------------------------------- */
main section.bg-surface-muted {
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, currentColor 9%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
}
main section.bg-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
main section.bg-primary::before,
main section.bg-primary::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(55vw, 800px);
  aspect-ratio: 1;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--nx-gold) 28%, transparent), transparent 70%);
}
main section.bg-primary::before {
  left: -10%;
  bottom: -60%;
  animation: nx-float 14s ease-in-out infinite alternate;
}
main section.bg-primary::after {
  right: -15%;
  top: -70%;
  opacity: 0.7;
  animation: nx-float 18s ease-in-out infinite alternate-reverse;
}

/* ---------- 12. Rodapé ---------------------------------------------- */
footer.mt-24 {
  position: relative;
}
footer.mt-24::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  opacity: 0.7;
  background: linear-gradient(90deg, transparent, var(--nx-gold), transparent);
  background-size: 200% 100%;
  animation: nx-footline 7s linear infinite;
}
@keyframes nx-footline {
  to { background-position: -200% 0; }
}
footer ul a {
  display: inline-block;
  transition: transform 0.3s var(--nx-ease), color 0.3s;
}
footer ul a:hover {
  transform: translateX(4px);
  color: var(--nx-gold);
}

/* ---------- 13. Entrada ao rolar, com cascata (navegadores modernos) --- */
/* Usa "translate/scale" (e não "transform") para não brigar com o hover dos cartões */
@keyframes nx-rise {
  from { opacity: 0; translate: 0 32px; scale: 0.97; }
  to   { opacity: 1; translate: 0 0;    scale: 1; }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main section:not(:first-of-type) :is(.container-editorial > *:not(.grid), .grid > *) {
      animation: nx-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
    main section:not(:first-of-type) .grid > *:nth-child(2) { animation-range: entry 6% entry 46%; }
    main section:not(:first-of-type) .grid > *:nth-child(3) { animation-range: entry 12% entry 52%; }
    main section:not(:first-of-type) .grid > *:nth-child(4) { animation-range: entry 18% entry 58%; }
    main section:not(:first-of-type) .grid > *:nth-child(n+5) { animation-range: entry 24% entry 64%; }
  }
}

/* ---------- 14. Acessibilidade: reduzir movimento -------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  main h1 em, main h2 em {
    background-position: 0 0;
  }
}