/* =============================================================================
   BitGame — iconos 3D (26-11-2026). Son renders 3D con fondo transparente, del mismo estilo que las gemas y las
   criaturas (assets/img/icons3d/), dentro de un <span class="i3d"> que les da vida:
     · sombra suave debajo;
     · un destello que los cruza, recortado a su silueta (máscara con el mismo render: --m);
     · una chispa de cuatro puntas que aparece al pasar el ratón.
   Dos ritmos:
     · portadas (.ic): siempre vivos, flotan despacio y cada pocos segundos les cruza el destello (cada uno con su
       desfase, --dl, para que no se muevan todos a la vez);
     · oficina (.ai): quietos, como corresponde a un sistema; saltan con destello al pasar el ratón por su fila y el
       de la sección activa flota.
   Se carga en las dos portadas y en las dos oficinas. Con «reducir movimiento» todo queda quieto.
   ============================================================================= */
.i3d {
  --s: 32px;
  position: relative; display: inline-block; flex: none; width: var(--s); height: var(--s);
  line-height: 0; vertical-align: middle; isolation: isolate;
}
.i3d > img {
  display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 80%;
  filter: drop-shadow(0 calc(var(--s) * .05) calc(var(--s) * .07) rgb(4 10 30 / .38));
  transition: translate 600ms cubic-bezier(.34, 1.56, .64, 1), scale 600ms cubic-bezier(.34, 1.56, .64, 1),
              rotate 600ms cubic-bezier(.34, 1.56, .64, 1), filter 600ms cubic-bezier(.32, .72, 0, 1);
}
/* destello recortado a la silueta del icono */
.i3d::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
  background: linear-gradient(110deg, transparent 40%, rgb(255 255 255 / .9) 50%, transparent 60%) no-repeat;
  background-size: 320% 100%; background-position: 150% 0; opacity: 0;
}
/* chispa de cuatro puntas */
.i3d::before {
  content: ''; position: absolute; z-index: 1; width: 36%; height: 36%; right: -8%; top: -8%; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0l2.4 9.6L24 12l-9.6 2.4L12 24l-2.4-9.6L0 12l9.6-2.4z' fill='%23FFE27A'/%3E%3Cpath d='M12 5l1.1 5.9L19 12l-5.9 1.1L12 19l-1.1-5.9L5 12l5.9-1.1z' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0; transform: scale(.2);
}
@keyframes i3d-float { 50% { transform: translateY(calc(var(--s) * -.07)); } }
@keyframes i3d-glint { 0% { background-position: 150% 0; opacity: 1; } 45%, 100% { background-position: -50% 0; opacity: 1; } }
@keyframes i3d-spark { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 35% { opacity: 1; transform: scale(1) rotate(45deg); } 65% { opacity: .85; transform: scale(.8) rotate(80deg); } }

/* ------------------------------------------------------------------ portadas: siempre vivos */
.ic.i3d > img { animation: i3d-float 4.8s cubic-bezier(.45, 0, .55, 1) infinite; animation-delay: calc(var(--dl, 0s) * -1); }
.ic.i3d::after { animation: i3d-glint 6s ease-in-out infinite; animation-delay: var(--dl, 0s); }
.ic.i3d:hover > img, a:hover > .ic.i3d > img, button:hover > .ic.i3d > img, li:hover > .ic.i3d > img, article:hover .ic.i3d > img {
  translate: 0 calc(var(--s) * -.06); scale: 1.1; rotate: -4deg;
  filter: drop-shadow(0 calc(var(--s) * .1) calc(var(--s) * .12) rgb(4 10 30 / .42)) brightness(1.06);
}
.ic.i3d:hover::before, a:hover > .ic.i3d::before, button:hover > .ic.i3d::before, li:hover > .ic.i3d::before, article:hover .ic.i3d::before {
  animation: i3d-spark 1.3s ease-in-out infinite;
}

/* ------------------------------------------------------------------ oficina: quietos; saltan al pasar el ratón */
.ai-host:hover .ai.i3d > img, .ai.i3d.ai-live > img {
  translate: 0 calc(var(--s) * -.08); scale: 1.12; rotate: -5deg;
  filter: drop-shadow(0 calc(var(--s) * .1) calc(var(--s) * .12) rgb(4 10 30 / .45)) brightness(1.06);
}
.ai-host:hover .ai.i3d::after { animation: i3d-glint 1.5s ease-in-out 1; }
.ai-host:hover .ai.i3d::before { animation: i3d-spark 1.4s ease-in-out infinite; }
.is-active .ai.i3d > img { animation: i3d-float 3.6s cubic-bezier(.45, 0, .55, 1) infinite; }
.is-active .ai.i3d::after { animation: i3d-glint 5s ease-in-out infinite .8s; }

@media (prefers-reduced-motion: reduce) {
  .i3d > img, .i3d::after, .i3d::before { animation: none !important; transition: none !important; }
}

/* Escenas e iconos fuera de la pantalla: animaciones en pausa (nodes-site.js y office-fx.js ponen .is-off). */
.is-off, .is-off * { animation-play-state: paused !important; }
