/* =========================================================================
   ANIMAÇÕES E MASCOTES 3D
   -------------------------------------------------------------------------
   - Mascotes (bonequinhos) com olhos que seguem o mouse
   - Login "peek-a-boo": olham você digitar, escondem os olhos na senha
   - Abertura estilo "impressora 3D imprimindo"
   - Cartões com inclinação 3D, cliques com efeito, formas flutuando
   Você não precisa editar nada aqui.
   ========================================================================= */

/* ---------- Trava o scroll enquanto a abertura roda ---------- */
body.intro-ativo { overflow: hidden; }

/* =========================================================================
   ABERTURA (impressora imprimindo o mascote)
   ========================================================================= */
.intro {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  background:
    radial-gradient(900px 500px at 50% 20%, rgba(124,58,237,.35), transparent),
    linear-gradient(160deg, #17132b, #0e0b1e 70%);
  color: #fff; text-align: center;
  transition: opacity .6s ease, visibility .6s;
}
.intro.sumir { opacity: 0; visibility: hidden; }

.intro-cena { position: relative; display: flex; flex-direction: column; align-items: center; }

.impressora {
  position: relative; width: 260px; height: 260px;
  display: flex; align-items: flex-end; justify-content: center;
}
/* -------------------------------------------------------------------------
   BICO (nozzle) — sobe junto com a peça, camada por camada.
   Duas animações independentes, sem conflito:
     top         -> altura do bico: desce até a base e sobe conforme imprime
     margin-left -> vai-e-vem horizontal rápido (depositando o material)
   ------------------------------------------------------------------------- */
.nozzle {
  position: absolute; top: 150px; left: calc(50% - 18px);
  width: 36px; height: 22px;
  background: linear-gradient(#e2e8f0, #5b6472);
  border-radius: 5px 5px 3px 3px;
  box-shadow: 0 0 16px rgba(124,58,237,.7);
  z-index: 4;
  animation: nozzleSobe 2.8s linear forwards,
             nozzleVaiVem 0.42s ease-in-out infinite;
}
/* ponta quente do bico (avermelhada) */
.nozzle::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 9px; height: 11px;
  background: linear-gradient(#fca5a5, #ef4444);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(239,68,68,.75);
}
/* filamento que desce alimentando o bico */
.nozzle::before {
  content: ""; position: absolute; left: 50%; top: -150px; transform: translateX(-50%);
  width: 3px; height: 160px;
  background: linear-gradient(rgba(124,58,237,0), rgba(124,58,237,.85));
  border-radius: 2px; opacity: .55;
}
@keyframes nozzleSobe {
  from { top: 150px; }   /* começa junto da mesa (base da peça) */
  to   { top: 12px; }    /* termina no topo da peça */
}
@keyframes nozzleVaiVem {
  0%, 100% { margin-left: -46px; }
  50%      { margin-left:  46px; }
}

/* a peça que sobe sendo "impressa" camada por camada */
.peca {
  position: relative; width: 190px; height: 210px;
  display: flex; align-items: flex-end; justify-content: center;
}
/* a peça é revelada DE BAIXO PARA CIMA, no mesmo tempo do bico (2.8s) */
.peca-svg {
  width: 170px; height: auto;
  clip-path: inset(100% 0 0 0);
  animation: imprimir 2.8s steps(28) forwards;
}
@keyframes imprimir { to { clip-path: inset(0 0 0 0); } }
/* textura das camadas surgindo junto */
.peca::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 2px, transparent 2px 6px);
  mix-blend-mode: overlay;
  clip-path: inset(100% 0 0 0);
  animation: imprimir 2.8s steps(28) forwards;
}
/* linha verde "quente" que sobe acompanhando a impressão */
.peca::after {
  content: ""; position: absolute; left: 8px; right: 8px; height: 4px; z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(37,211,102,.9), transparent);
  filter: blur(1px); border-radius: 4px; pointer-events: none;
  animation: linhaQuente 2.8s linear forwards;
}
@keyframes linhaQuente {
  from { bottom: 2%; opacity: 1; }
  to   { bottom: 98%; opacity: 0; }
}
/* mesa da impressora */
.mesa {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 220px; height: 16px; border-radius: 6px;
  background: linear-gradient(#3b3560, #211c3d);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.08);
}

.intro-nome {
  font-size: 30px; font-weight: 800; margin-top: 14px; letter-spacing: -.5px;
  opacity: 0; animation: subirFade .6s ease .9s forwards;
}
.intro-status { color: #b9b2e0; font-size: 14px; opacity: 0; animation: subirFade .6s ease 1.2s forwards; }
.reticencias::after { content: ""; animation: reticencias 1s steps(4) infinite; }
@keyframes reticencias { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

.intro-barra {
  width: 220px; height: 6px; border-radius: 999px; margin-top: 12px;
  background: rgba(255,255,255,.12); overflow: hidden;
  opacity: 0; animation: subirFade .5s ease .6s forwards;
}
.intro-barra i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #7c3aed, #25d366);
  animation: carregarBarra 2.8s linear forwards;
}
@keyframes carregarBarra { to { width: 100%; } }

.intro-skip {
  position: absolute; bottom: 26px; right: 26px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 13px;
}
.intro-skip:hover { background: rgba(255,255,255,.22); }

@keyframes subirFade { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: translateY(0);} }

/* =========================================================================
   MASCOTES (bonequinhos)
   ========================================================================= */
.mascote { pointer-events: none; user-select: none; }
.mascote-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* flutuar de leve (idle) */
.m-corpo { transform-box: fill-box; transform-origin: center; animation: flutua 4s ease-in-out infinite; }
@keyframes flutua { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* luz da antena piscando */
.m-antena { animation: brilho 1.6s ease-in-out infinite; }
@keyframes brilho { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* pupilas — a posição é controlada pelo JS (segue o mouse). Transição suave. */
.m-pupila { transition: transform .08s linear; }

/* pálpebras (piscar / semicerrar) */
.m-palpebra {
  transform-box: fill-box; transform-origin: 50% 0%;
  transform: scaleY(0); transition: transform .12s ease;
}
.mascote-svg.piscando .m-palpebra { transform: scaleY(1.05); }

/* bochechas coradas (na senha) */
.m-blush { opacity: 0; transition: opacity .3s ease; }
.mascote-svg.envergonhado .m-blush { opacity: .8; }

/* boca "falando" quando você digita */
.m-boca { transform-box: fill-box; transform-origin: center; }
.mascote-svg.falando .m-boca { animation: falar .26s ease-in-out infinite; }
@keyframes falar { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(2); } }

/* mãos — sobem para tapar os olhos na senha */
.m-mao { transition: transform .45s cubic-bezier(.34,1.56,.64,1); }
.mascote-svg.tampando .m-mao-esq { transform: translate(50px, -68px); }
.mascote-svg.tampando .m-mao-dir { transform: translate(-50px, -68px); }
/* na senha os olhos também se fecham um pouco */
.mascote-svg.tampando .m-palpebra { transform: scaleY(.8); }

/* comemorar (ao adicionar no carrinho) */
.mascote-svg.feliz { animation: feliz .8s ease; }
@keyframes feliz {
  0%,100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-18px) scale(1.06) rotate(-4deg); }
  50% { transform: translateY(0) scale(.97) rotate(3deg); }
  75% { transform: translateY(-7px) rotate(-2deg); }
}

/* posições dos mascotes na tela */
.mascote-hero {
  width: min(230px, 60vw); margin: 26px auto 0; filter: drop-shadow(0 20px 30px rgba(124,58,237,.35));
}
.mascote-corner {
  position: fixed; left: 18px; bottom: 16px; width: 96px; z-index: 30;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.2));
  opacity: 0; transform: translateY(20px); transition: opacity .5s ease, transform .5s ease;
}
.mascote-corner.aparecer { opacity: 1; transform: translateY(0); }
.mascote-login {
  width: 130px; margin: 6px auto -6px; position: relative; z-index: 2;
  filter: drop-shadow(0 12px 18px rgba(124,58,237,.3));
}
@media (max-width: 640px) { .mascote-corner { display: none; } }

/* =========================================================================
   FORMAS 3D FLUTUANDO (fundo do banner)
   ========================================================================= */
.formas-3d { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.forma {
  position: absolute; width: 60px; height: 60px; opacity: .8;
  transform-style: preserve-3d; animation: girarForma linear infinite;
}
.cubo { width: 46px; height: 46px; position: relative; transform-style: preserve-3d; }
.forma { --frgb: 124,58,237; }
.cubo span {
  position: absolute; width: 46px; height: 46px; background: rgba(var(--frgb), .20);
  border: 1.5px solid rgba(var(--frgb), .60); border-radius: 8px;
}
.cubo .f1 { transform: rotateY(0deg) translateZ(23px); }
.cubo .f2 { transform: rotateY(90deg) translateZ(23px); }
.cubo .f3 { transform: rotateY(180deg) translateZ(23px); }
.cubo .f4 { transform: rotateY(-90deg) translateZ(23px); }
.cubo .f5 { transform: rotateX(90deg) translateZ(23px); background: rgba(var(--frgb), .30); }
.cubo .f6 { transform: rotateX(-90deg) translateZ(23px); background: rgba(var(--frgb), .30); }
@keyframes girarForma {
  from { transform: rotateX(0) rotateY(0) translateY(0); }
  to   { transform: rotateX(360deg) rotateY(360deg) translateY(-30px); }
}
.hero { position: relative; overflow: hidden; }
.hero .container { position: relative; z-index: 1; }

/* =========================================================================
   PERSONAGENS FLUTUANDO NO FUNDO DO SITE INTEIRO
   ========================================================================= */
.fundo-personagens {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.bg-mascote {
  position: absolute; width: 88px; opacity: .72; --s: 1;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.16));
  animation: flutuaBg linear infinite;
  transition: opacity .3s ease;
}
.bg-mascote:hover { opacity: 1; }
.bg-mascote .mascote-svg { width: 100%; height: auto; }
/* usa a variável --s (definida por JS) para não perder a escala na animação */
@keyframes flutuaBg {
  0%   { transform: translateY(0)     rotate(-4deg) scale(var(--s)); }
  50%  { transform: translateY(-26px) rotate(4deg)  scale(var(--s)); }
  100% { transform: translateY(0)     rotate(-4deg) scale(var(--s)); }
}
/* garante que o conteúdo fique acima dos personagens de fundo */
.topo, .hero, main, .rodape, .barra-busca { position: relative; z-index: 1; }
@media (max-width: 640px) {
  .bg-mascote { width: 56px; opacity: .4; }
}

/* =========================================================================
   CARTÕES COM INCLINAÇÃO 3D + brilho
   ========================================================================= */
.grid-produtos { perspective: 1000px; }
.card { transition: transform .3s ease, box-shadow .3s ease; transform-style: preserve-3d; will-change: transform; }
.card .card-foto img { transition: transform .35s ease; }

/* =========================================================================
   CLIQUES (efeito de pressionar + ondinha)
   ========================================================================= */
.btn-principal, .btn-add, .btn-carrinho, .btn-ghost, .qtd-btn, .chip-cor {
  position: relative; overflow: hidden;
}
.btn-principal:active, .btn-add:active, .btn-carrinho:active, .chip-cor:active { transform: scale(.94); }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255,255,255,.5); pointer-events: none; animation: ripple .6s ease-out;
}
@keyframes ripple { to { transform: scale(2.8); opacity: 0; } }

/* carrinho balança quando adiciona item */
.btn-carrinho.balanca { animation: balanca .6s ease; }
@keyframes balanca {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-12deg) scale(1.05); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(3deg); }
}

/* item "voando" para o carrinho */
.voa-carrinho {
  position: fixed; z-index: 120; width: 70px; height: 70px; border-radius: 14px;
  object-fit: cover; box-shadow: 0 10px 24px rgba(0,0,0,.3); pointer-events: none;
  transition: transform .8s cubic-bezier(.5,-0.2,.7,1), opacity .8s ease; opacity: .95;
}

/* selo de destaque pulsa */
.selo { animation: pulsaSelo 2s ease-in-out infinite; }
@keyframes pulsaSelo { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* entrada dos cards ao carregar */
.card { animation: entradaCard .5s ease both; }
@keyframes entradaCard { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================================
   Respeita quem prefere menos animação
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .m-corpo, .m-antena, .forma, .selo, .card, .peca-svg, .nozzle, .intro-barra i { animation: none !important; }
  .peca-svg { clip-path: none; }
}
