/* ==========================================================================
   NEXUS - EFEITOS

   Bordas animadas dos produtos em destaque (fire / sketch / spin), cards VIP
   com borda neon e a animacao de entrada das secoes.

   Fica separado do tema de proposito: e a unica parte do CSS que existe por
   causa de merchandising, nao de layout. Se um dia os destaques sairem, este
   arquivo sai junto e nada mais quebra.

   As cores vem de variaveis inline que o main.js escreve em cada card
   (--mc-border-color / --neon-color), a partir de productAnimations e
   neonProductsConfig no layout. Por isso nao ha cor fixa aqui.
   ========================================================================== */

/* ==========================================================================
   BORDAS CUSTOMIZADAS — INFRAESTRUTURA DE CORES (fire / sketch / spin)
   ==========================================================================
   Variáveis configuráveis via JS (productAnimations):
     --mc-border-color    cor principal da borda (fallback: --primary do site)
     --mc-border-color-2  cor secundária (fallback: --mc-border-color → --secondary)

   Modifier `.rainbow` cicla por todas as cores (efeito arco-íris).
   ========================================================================== */

/* Mensagem customizada acima da badge do produto (campo "message" da borda).
   Usa as mesmas cores da borda (--mc-border-color / --mc-border-color-2). */
.mc-border-message {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  max-width: 92%;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--mc-border-color, hsl(var(--primary))),
    var(--mc-border-color-2, var(--mc-border-color, hsl(var(--secondary))))
  );
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 14px color-mix(in srgb, var(--mc-border-color, hsl(var(--primary))) 60%, transparent);
}

/* Efeito arco-íris acompanha a mensagem */
.rainbow .mc-border-message {
  background: linear-gradient(90deg,
    #ff0040, #ff8c00, #ffe600, #00d26a, #00b3ff, #6a5cff, #ff00d4);
}

@property --mc-hue {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: true;
}

@keyframes mc-rainbow-cycle {
  to { --mc-hue: 360deg; }
}

.fire-product.rainbow,
.sketch-product.rainbow,
.spin-product.rainbow {
  animation: mc-rainbow-cycle 6s linear infinite;
}

/* ==========================================================================
   FIRE BORDER (Animated displaced border for highlighted products)
   ========================================================================== */

.fire-product {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  border-color: transparent !important;
  --fire-color: var(--mc-border-color, hsl(var(--primary)));
  --fire-light: var(--mc-border-color-2, var(--mc-border-color, hsl(var(--secondary))));
  --fire-gradient: linear-gradient(
    -30deg,
    color-mix(in srgb, var(--fire-light) 40%, transparent),
    transparent 30%,
    transparent 70%,
    color-mix(in srgb, var(--fire-color) 40%, transparent)
  );
}

.fire-product .fire-border-wrapper {
  position: absolute;
  inset: -2px;
  border-radius: calc(0.7rem + 2px);
  pointer-events: none;
  z-index: 5;
  filter: hue-rotate(var(--mc-hue, 0deg));
}

.fire-product .fire-bg-glow {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  filter: blur(28px);
  transform: scale(1.05);
  opacity: 0.55;
  z-index: -2;
  background: linear-gradient(-30deg, var(--fire-light), transparent, var(--fire-color));
  pointer-events: none;
}

.fire-product .fire-border-outer {
  position: absolute;
  inset: 0;
  border: 2px solid color-mix(in srgb, var(--fire-color) 50%, transparent);
  border-radius: inherit;
  pointer-events: none;
}

.fire-product .fire-border-main {
  position: absolute;
  inset: 0;
  border: 2px solid var(--fire-color);
  border-radius: inherit;
  pointer-events: none;
  filter: none;
  animation: fire-border-pulse 2.2s ease-in-out infinite alternate;
}

@keyframes fire-border-pulse {
  from { opacity: 0.65; box-shadow: 0 0 8px color-mix(in srgb, var(--fire-color) 50%, transparent); }
  to { opacity: 1; box-shadow: 0 0 16px color-mix(in srgb, var(--fire-light) 55%, transparent); }
}

@keyframes vip-fire-glow {
  from {
    opacity: 0.55;
    transform: scale(1);
    filter: blur(20px);
  }
  to {
    opacity: 0.95;
    transform: scale(1.04);
    filter: blur(26px);
  }
}

@keyframes vip-spin-glow {
  from { opacity: 0.5; transform: scale(0.98); }
  to { opacity: 0.9; transform: scale(1.03); }
}

/* ===== VIP premium: Rubi, Magnata, Chefão ===== */
.fire-product[data-vip="rubi"]::after,
.fire-product[data-vip="chefa"]::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 80% 55% at 50% 35%,
    color-mix(in srgb, var(--fire-light) 55%, transparent),
    color-mix(in srgb, var(--fire-color) 25%, transparent) 45%,
    transparent 72%
  );
  animation: vip-fire-glow 2.2s ease-in-out infinite alternate;
}

.fire-product[data-vip="rubi"] .fire-border-main {
  border-width: 2.5px;
  animation: fire-border-pulse 1.8s ease-in-out infinite alternate;
  box-shadow:
    0 0 14px color-mix(in srgb, var(--fire-color) 65%, transparent),
    0 0 28px color-mix(in srgb, var(--fire-light) 40%, transparent);
}

.fire-product[data-vip="rubi"] .fire-border-outer {
  border-color: color-mix(in srgb, var(--fire-light) 70%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--fire-color) 35%, transparent);
}

.fire-product[data-vip="chefa"]::after {
  background: radial-gradient(
    ellipse 85% 60% at 50% 30%,
    color-mix(in srgb, var(--fire-light) 70%, transparent),
    color-mix(in srgb, var(--fire-color) 35%, transparent) 50%,
    transparent 75%
  );
  animation: vip-fire-glow 1.6s ease-in-out infinite alternate;
}

.fire-product[data-vip="chefa"] .fire-border-main {
  border-width: 3px;
  animation: fire-border-pulse 1.4s ease-in-out infinite alternate;
  box-shadow:
    0 0 18px color-mix(in srgb, var(--fire-color) 75%, transparent),
    0 0 36px color-mix(in srgb, var(--fire-light) 50%, transparent),
    0 0 52px color-mix(in srgb, var(--fire-color) 25%, transparent);
}

.fire-product[data-vip="chefa"] .fire-border-outer {
  border-width: 2.5px;
  border-color: color-mix(in srgb, var(--fire-light) 80%, transparent);
}

.spin-product[data-vip="magnata"]::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 75% 50% at 50% 40%,
    color-mix(in srgb, var(--spin-color-2) 50%, transparent),
    color-mix(in srgb, var(--spin-color) 22%, transparent) 55%,
    transparent 78%
  );
  animation: vip-spin-glow 2s ease-in-out infinite alternate;
}

.spin-product[data-vip="magnata"] .spin-base {
  stroke-width: 3;
  stroke-opacity: 0.95;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--spin-color) 50%, transparent));
}

.spin-product[data-vip="magnata"] .spin-head {
  stroke-width: 5;
  filter:
    drop-shadow(0 0 6px var(--spin-color-2))
    drop-shadow(0 0 16px color-mix(in srgb, var(--spin-color-2) 75%, transparent))
    drop-shadow(0 0 32px color-mix(in srgb, var(--spin-color) 45%, transparent))
    drop-shadow(0 0 48px color-mix(in srgb, var(--spin-color-2) 25%, transparent));
}

html.mc-perf .fire-product[data-vip] .fire-border-main,
html.mc-perf .spin-product[data-vip] .spin-head {
  animation: none !important;
}

html.mc-perf .fire-product[data-vip="rubi"] .fire-border-main {
  box-shadow: 0 0 20px color-mix(in srgb, var(--fire-color) 60%, transparent);
}

html.mc-perf .fire-product[data-vip="chefa"] .fire-border-main {
  box-shadow:
    0 0 22px color-mix(in srgb, var(--fire-color) 70%, transparent),
    0 0 38px color-mix(in srgb, var(--fire-light) 35%, transparent);
}

html.mc-perf .spin-product[data-vip="magnata"] .spin-head {
  filter: drop-shadow(0 0 12px var(--spin-color-2)) drop-shadow(0 0 24px color-mix(in srgb, var(--spin-color) 40%, transparent));
}

.fire-product .fire-bg-glow,
.fire-product .fire-overlay,
.fire-product .fire-glow-1,
.fire-product .fire-glow-2 {
  display: none;
}

.fire-product .fire-glow-1 {
  position: absolute;
  inset: 0;
  border: 2px solid color-mix(in srgb, var(--fire-color) 60%, transparent);
  border-radius: inherit;
  pointer-events: none;
  filter: blur(1px);
}

.fire-product .fire-glow-2 {
  position: absolute;
  inset: 0;
  border: 2px solid var(--fire-light);
  border-radius: inherit;
  pointer-events: none;
  filter: blur(4px);
  opacity: 0.85;
}

.fire-product .fire-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.6;
  mix-blend-mode: overlay;
  transform: scale(1.08);
  filter: blur(14px);
  background: var(--fire-gradient);
}

/* ==========================================================================
   SKETCH BORDER (Style 2: wavy hand-drawn outline with marching animation)
   ========================================================================== */

.sketch-product {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  border-color: transparent !important;
  --sketch-color: var(--mc-border-color, hsl(var(--primary)));
}

.fire-product > div:first-child,
.sketch-product > div:first-child,
.spin-product > div:first-child,
.neon-product .mc-product-media {
  border-top-left-radius: 0.7rem;
  border-top-right-radius: 0.7rem;
}

.sketch-product .sketch-halo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background-color: rgb(var(--background));
  filter: drop-shadow(0 0 30px var(--sketch-color)) hue-rotate(var(--mc-hue, 0deg));
}

.sketch-product .sketch-svg {
  position: absolute;
  inset: -28px;
  width: calc(100% + 56px);
  height: calc(100% + 56px);
  pointer-events: none;
  z-index: 3;
  overflow: visible;
  stroke: var(--sketch-color);
  stroke-dasharray: 307 131;
  animation: sketch-dash 9s linear infinite;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--sketch-color) 70%, transparent)) hue-rotate(var(--mc-hue, 0deg));
}

@keyframes sketch-dash {
  to { stroke-dashoffset: -438px; }
}

/* ==========================================================================
   SPIN (Thin conic gradient border with a rotating bright highlight)
   ========================================================================== */

.spin-product {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  border-color: transparent !important;
  --spin-color: var(--mc-border-color, hsl(var(--primary)));
  --spin-color-2: var(--mc-border-color-2, var(--mc-border-color, hsl(var(--secondary))));
}

.spin-product .spin-svg {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 20;
  overflow: visible;
  filter: hue-rotate(var(--mc-hue, 0deg));
}

.spin-product .spin-base {
  fill: none;
  stroke: var(--spin-color);
  stroke-width: 2;
  stroke-opacity: 0.7;
}

.spin-product .spin-head {
  fill: none;
  stroke: var(--spin-color-2);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 18 82;
  animation: spin-march 2.4s linear infinite;
  filter:
    drop-shadow(0 0 4px var(--spin-color-2))
    drop-shadow(0 0 10px color-mix(in srgb, var(--spin-color-2) 60%, transparent))
    drop-shadow(0 0 18px color-mix(in srgb, var(--spin-color) 40%, transparent));
}

@keyframes spin-march {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -100; }
}

/* ==========================================================================
   CARD VIP COM BORDA NEON
   A cor vem do tier (bronze/prata/ouro/elite) definido em neonProductsConfig,
   no layout. O bloco "AJUSTES DO TEMA NOVO", mais abaixo, e quem alinha isto
   com o tema atual - nao edite as cores aqui.
   ========================================================================== */
@keyframes fire-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes neon-card-pulse {
  0% {
    box-shadow:
      0 15px 40px -10px rgba(0, 0, 0, 0.9),
      0 0 18px color-mix(in srgb, var(--neon-color) 50%, transparent),
      inset 0 0 12px color-mix(in srgb, var(--neon-color) 12%, transparent);
  }
  100% {
    box-shadow:
      0 22px 48px -6px rgba(0, 0, 0, 0.95),
      0 0 32px color-mix(in srgb, var(--neon-glow) 55%, transparent),
      inset 0 0 16px color-mix(in srgb, var(--neon-glow) 18%, transparent);
  }
}

@keyframes neon-badge-bounce {
  0%, 100% { transform: translate(-50%, 0px) scale(1); }
  50% { transform: translate(-50%, -6px) scale(1.03); }
}

.neon-product {
  position: relative;
  isolation: isolate;
  background: #0d1209 !important;
  /* mesmo raio dos outros cards do grid (rounded-[0.7rem]) para os VIPs
     neon não destoarem de fire/spin/sketch agora que têm o mesmo tamanho */
  border-radius: 0.7rem;
  border: none !important;
  --neon-color: hsl(var(--primary));
  --neon-glow: hsl(var(--secondary));
  --neon-text: #111827;
  animation: neon-card-pulse 2.4s infinite alternate ease-in-out;
  overflow: visible !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* sem margin: o card neon deve preencher a célula do grid igual aos
     fire/spin/sketch, senão bronze/prata/ouro/platina ficam menores
     que rubi/magnata/chefão e o grid abre buracos. */
}

.neon-product[data-vip="bronze"] {
  background: linear-gradient(180deg, #1a1208 0%, #0d1209 100%) !important;
}

.neon-product[data-vip="silver"] {
  background: linear-gradient(180deg, #141820 0%, #0d1209 100%) !important;
}

.neon-product[data-vip="gold"] {
  background: linear-gradient(180deg, #1a1608 0%, #0d1209 100%) !important;
}

.neon-product[data-vip="elite"] {
  background: linear-gradient(180deg, #121808 0%, #0a1008 100%) !important;
}

.neon-product:hover {
  transform: scale(1.02) translateY(-4px);
  z-index: 10;
  box-shadow: 0 16px 40px -8px rgba(0,0,0,0.85), 0 0 24px var(--neon-color);
}

/* Botão do Card no Hover */
.neon-product:hover .btn-primary {
  background: linear-gradient(135deg, var(--neon-color), var(--neon-glow));
  color: var(--neon-text, #111827);
  box-shadow: 0 0 24px color-mix(in srgb, var(--neon-color) 45%, transparent);
  transform: scale(1.03);
  font-weight: 800;
}

/* Borda Fina Estática Elegante */
.neon-product::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px; 
  background: linear-gradient(135deg, var(--neon-color), rgba(255,255,255,0.1), var(--neon-glow));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 1;
  pointer-events: none;
}

/* Efeito Dinâmico de Borda Giratória (Glow) */
.neon-product .neon-border-wrapper {
  position: absolute;
  inset: -2px; 
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
  overflow: hidden;
}

.neon-product .neon-border,
.neon-product .neon-border-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.neon-product .neon-border::before,
.neon-product .neon-border-glow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300%;
  height: 300%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 10%,
    var(--neon-color) 25%,
    #ffffff 30%,
    transparent 45%,
    transparent 60%,
    var(--neon-glow) 75%,
    #ffffff 80%,
    transparent 95%,
    transparent 100%
  );
  transform: translate(-50%, -50%);
  animation: fire-spin 3s linear infinite;
}

.neon-product .neon-border-glow {
  display: none;
}

/* Badge (Selinho de Destaque) */
.neon-product .neon-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: linear-gradient(135deg, var(--neon-color), var(--neon-glow));
  color: var(--neon-text, #ffffff);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: 9999px;
  max-width: calc(100% - 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 14px color-mix(in srgb, var(--neon-color) 40%, transparent);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: neon-badge-bounce 3s infinite ease-in-out;
  border: 1px solid color-mix(in srgb, var(--neon-glow) 65%, white);
}

/* Brilho reflexivo interno do card */
.neon-product .neon-shine {
  background-image: linear-gradient(
    to right,
    transparent,
    color-mix(in srgb, var(--neon-glow) 28%, transparent),
    transparent
  ) !important;
}



/* ==========================================================================
   AJUSTES DO TEMA NOVO

   O tema passou os cards para raio 16px e tirou os brilhos permanentes. As
   regras acima nasceram com raio 0.7rem e com animacao infinita ligada; este
   bloco reconcilia as duas coisas, no fim do arquivo para vencer a cascata.
   ========================================================================== */

/* 1. Mesmo raio dos cards comuns, para o destaque nao destoar da grade. */
.neon-product,
.fire-product,
.sketch-product,
.spin-product {
  border-radius: var(--nx-r-lg);
}

.fire-product .fire-border-wrapper,
.sketch-product .sketch-border-wrapper,
.spin-product .spin-border-wrapper,
.neon-product .neon-border-wrapper {
  border-radius: calc(var(--nx-r-lg) + 2px);
}

/* 2. Sem pulsacao permanente. Quatro a oito cards piscando sem parar puxam o
      olho para longe do produto e mantem a GPU acordada em celular. A borda
      colorida ja marca o destaque; o brilho agora e so no hover. */
.neon-product {
  animation: none;
  box-shadow: var(--nx-sh-2);
}

.neon-product .neon-badge {
  animation: none;
}

.fire-product .fire-border-main {
  animation: none;
}

.fire-product .fire-bg-glow {
  opacity: 0.28;
}

/* 3. O card de destaque segue o mesmo hover do card comum (subir 3px), em vez
      de crescer 2% e empurrar os vizinhos. */
.neon-product:hover,
.fire-product:hover,
.sketch-product:hover,
.spin-product:hover {
  transform: translateY(-3px);
}

/* 4. Fundo do card VIP: o tema tem uma superficie so; o verde-escuro antigo
      (#0d1209) destoava de todo o resto. */
.neon-product,
.neon-product[data-vip="bronze"],
.neon-product[data-vip="silver"],
.neon-product[data-vip="gold"],
.neon-product[data-vip="elite"] {
  background: var(--nx-surface) !important;
}

/* ==========================================================================
   ANIMACAO DE ENTRADA
   ========================================================================== */
.reveal-fade-up {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0s);
}

.reveal-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   MODO LEVE E PREFERENCIA DE MOVIMENTO REDUZIDO

   html.mc-perf e ligado no <head> para aparelho fraco, dado economizado ou
   quando o sistema pede menos movimento.
   ========================================================================== */
html.mc-perf .reveal-fade-up {
  opacity: 1;
  transform: none;
  transition: none;
}

html.mc-perf .mc-product-card:hover,
html.mc-perf .mc-product-card:hover .mc-product-image,
html.mc-perf .neon-product:hover,
html.mc-perf .fire-product:hover,
html.mc-perf .sketch-product:hover,
html.mc-perf .spin-product:hover {
  transform: none;
}

html.mc-perf .fire-product .fire-bg-glow,
html.mc-perf .neon-product .neon-shine {
  display: none;
}

html.mc-perf .fire-product.rainbow,
html.mc-perf .sketch-product.rainbow,
html.mc-perf .spin-product.rainbow,
html.mc-perf .neon-product .neon-border::before,
html.mc-perf .spin-product .spin-border::before {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .mc-product-card,
  .mc-product-card:hover,
  .mc-product-card:hover .mc-product-image,
  .neon-product:hover,
  .fire-product:hover,
  .sketch-product:hover,
  .spin-product:hover,
  .nx-cat-tile:hover {
    transform: none;
    transition: none;
  }

  .fire-product.rainbow,
  .sketch-product.rainbow,
  .spin-product.rainbow,
  .neon-product .neon-border::before,
  .spin-product .spin-border::before,
  .sketch-product .sketch-border {
    animation: none;
  }
}

/* ==========================================================================
   FUNDO PARA ARTES FORA DO 4:5

   Medido em 29/08/2026: 169 das 245 imagens do catalogo nao sao 4:5 (a maioria
   e render de veiculo 1024x640). Como o quadro do card e 4:5, a propria arte
   entra atras, ampliada e desfocada, em vez de sobrar faixa preta.
   A variavel --nx-media-bg vem do proprio template do card.
   ========================================================================== */
.mc-product-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--nx-media-bg, none);
  background-size: cover;
  background-position: center;
  /* Desfoque FORTE de proposito: o objetivo e uma mancha da cor do produto,
     nao uma segunda copia da arte. Com blur menor dava para reconhecer a
     imagem atras (uma roda gigante atras do carro) e o card ficava confuso.
     brightness baixa o suficiente para o produto na frente continuar sendo o
     que o olho pega primeiro. */
  filter: blur(46px) brightness(0.5) saturate(1.25);
  transform: scale(1.4);
  pointer-events: none;
}

html.mc-perf .mc-product-media::after {
  filter: none;
  opacity: 0.3;
}
