/**
 * robo-placa.css
 * =============================================================================
 * Robô da unidade Campolim (mesma geometria da página do Campolim) segurando um
 * letreiro de lâmpadas com o número de projetos em andamento.
 *
 * Tudo é CSS 3D: cada peça "maciça" (cabeça, tronco, orelhas, antena, mãos e a
 * moldura da placa) é uma pilha de camadas em profundidade criada pelo
 * js/robo-placa.js. As medidas abaixo são as originais do robô (px "nativos");
 * o componente inteiro é reduzido com --rp-escala.
 * =============================================================================
 */

.robo-placa {
  --rp-escala: 0.62;
  /* cores do robô (as mesmas da página do Campolim) */
  --rp-topo: #818cf8;
  --rp-frente: #6366f1;
  --rp-lado: #4f46e5;
  --rp-fundo: #4338ca;
  --rp-linha: #dbe3ff;
  /* lâmpadas */
  --rp-luz: #ffd66b;
  --rp-luz-forte: #ffb020;
  --rp-luz-off: rgba(255, 214, 107, 0.13);

  position: relative;
  width: calc(320px * var(--rp-escala));
  height: calc(470px * var(--rp-escala));
  flex-shrink: 0;
}

/* halo suave atrás do robô (fica no fundo claro da página) */
.robo-placa::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 34%;
  width: 120%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.16) 0%, transparent 62%);
  pointer-events: none;
}

.rp-palco {
  position: absolute;
  left: 50%;
  top: 0;
  width: 320px;
  height: 470px;
  margin-left: -160px;
  transform: scale(var(--rp-escala));
  transform-origin: top center;
  perspective: 1400px;
}

.rp-mira {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rp-rx, 0deg)) rotateY(var(--rp-ry, 0deg));
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rp-flutua {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: rpFlutua 6s ease-in-out infinite;
}

@keyframes rpFlutua {
  0%, 100% { transform: translateY(-6px); }
  50% { transform: translateY(6px); }
}

/* raiz do robô: 200 x 360, com espaço de 56px acima para a antena */
.rp-robo {
  position: absolute;
  left: 60px;
  top: 56px;
  width: 200px;
  height: 360px;
  transform-style: preserve-3d;
}

.rp-face {
  position: absolute;
  top: 50%;
  left: 50%;
}

/* ---------- peças maciças: pilha de camadas (criadas no JS) ---------- */
.rp-casca {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.rp-casca i,
.rp-orelha i,
.rp-bola i,
.rp-mao i {
  position: absolute;
  inset: 0;
  display: block;
  transform: translateZ(var(--z, 0px));
}

/* ---------- ANTENA ---------- */
.rp-antena {
  position: absolute;
  top: -38px;
  left: 50%;
  margin-left: -3px;
  width: 6px;
  height: 38px;
  transform: translateZ(25px);
  transform-style: preserve-3d;
}

.rp-antena-haste {
  width: 6px;
  height: 38px;
  border-radius: 3px;
  background: linear-gradient(var(--rp-topo), var(--rp-lado));
}

.rp-bola {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  transform-style: preserve-3d;
  filter: drop-shadow(0 0 6px var(--rp-lado));
}

.rp-bola i,
.rp-orelha i {
  border-radius: 50%;
  background: var(--c, var(--rp-lado));
}

/* ---------- CABEÇA ---------- */
.rp-cabeca {
  position: absolute;
  top: 0;
  left: 50%;
  width: 240px;
  height: 160px;
  margin-left: -120px;
  transform-style: preserve-3d;
  transform-origin: 50% 96%;
  transform: rotateX(var(--rp-cx, 0deg)) rotateY(var(--rp-cy, 0deg));
  transition: transform 0.35s ease-out;
}

.rp-orelha {
  position: absolute;
  top: 50%;
  width: 38px;
  height: 56px;
  margin-top: -28px;
  transform-style: preserve-3d;
}

.rp-orelha.esq { left: -18px; }
.rp-orelha.dir { right: -18px; }

.rp-casca-cabeca {
  width: 240px;
  height: 160px;
  margin: -80px 0 0 -120px;
}

.rp-casca-cabeca i {
  border-radius: 78px;
  border: 11px solid var(--c, var(--rp-lado));
}

.rp-cabeca .rp-face {
  width: 240px;
  height: 160px;
  margin: -80px 0 0 -120px;
  padding: 16px 16px 26px;
  border-radius: 78px;
  border: 2px solid var(--rp-lado);
  background: linear-gradient(160deg, var(--rp-topo) 0%, var(--rp-frente) 42%, var(--rp-lado) 100%);
  box-shadow: inset -6px -8px 22px rgba(0, 0, 0, 0.22);
  transform: translateZ(25px);
}

.rp-led {
  position: absolute;
  bottom: 9px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: rpLed 3.2s ease-in-out infinite;
}

@keyframes rpLed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* tela de TV de tubo */
.rp-tela {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 58px;
  border: 5px solid #14122f;
  background: radial-gradient(125% 125% at 50% 42%, #1c1a45 0%, #0d0b26 52%, #05041a 100%);
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.92), inset 0 0 14px rgba(165, 180, 252, 0.16);
}

.rp-rosto {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  filter: drop-shadow(0 0 7px rgba(165, 180, 252, 0.9));
  transform: translate(var(--rp-ox, 0px), var(--rp-oy, 0px));
  transition: transform 0.3s ease-out;
}

.rp-olhos {
  display: flex;
  gap: 38px;
}

.rp-olho {
  position: relative;
  width: 36px;
  height: 36px;
}

/* olho feliz (arco) e olho piscando (linha) */
.rp-olho::before,
.rp-olho::after {
  content: "";
  position: absolute;
  display: block;
  transition: opacity 0.12s ease;
}

.rp-olho::before {
  inset: 0;
  border: 6px solid var(--rp-linha);
  border-radius: 50%;
  clip-path: inset(0 0 56% 0);
}

.rp-olho::after {
  left: 2px;
  right: 2px;
  top: 15px;
  height: 6px;
  border-radius: 6px;
  background: var(--rp-linha);
  opacity: 0;
}

.robo-placa.piscando .rp-olho::before { opacity: 0; }
.robo-placa.piscando .rp-olho::after { opacity: 1; }

.rp-boca {
  width: 58px;
  height: 24px;
  margin-top: 4px;
  border-bottom: 6px solid var(--rp-linha);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-radius: 0 0 46px 46px;
}

.rp-varredura {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.42) 2px 4px);
}

.rp-vidro {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.05) 24%, transparent 44%),
    radial-gradient(135% 125% at 50% 48%, transparent 52%, rgba(0, 0, 0, 0.62) 100%);
}

/* ---------- PESCOÇO ---------- */
.rp-pescoco {
  position: absolute;
  top: 160px;
  left: 50%;
  width: 40px;
  height: 50px;
  margin-left: -20px;
  transform-style: preserve-3d;
}

.rp-pescoco .rp-face {
  width: 40px;
  height: 50px;
  margin: -25px 0 0 -20px;
  background: repeating-linear-gradient(to bottom, #a5b4fc 0 6px, var(--rp-fundo) 6px 10px);
}

.rp-pescoco .f1 { transform: translateZ(20px); }
.rp-pescoco .f2 { transform: rotateY(180deg) translateZ(20px); }
.rp-pescoco .f3 { transform: rotateY(-90deg) translateZ(20px); }
.rp-pescoco .f4 { transform: rotateY(90deg) translateZ(20px); }

/* ---------- TRONCO ---------- */
.rp-tronco {
  position: absolute;
  top: 210px;
  left: 50%;
  width: 180px;
  height: 150px;
  margin-left: -90px;
  transform-style: preserve-3d;
}

.rp-casca-tronco {
  width: 180px;
  height: 150px;
  margin: -75px 0 0 -90px;
}

.rp-casca-tronco i {
  border-radius: 90px 90px 18px 18px;
  background: var(--c, var(--rp-lado));
}

.rp-tronco .rp-face {
  width: 180px;
  height: 150px;
  margin: -75px 0 0 -90px;
  border-radius: 90px 90px 18px 18px;
  border: 2px solid var(--rp-lado);
  background: linear-gradient(160deg, var(--rp-topo) 0%, var(--rp-frente) 45%, var(--rp-lado) 100%);
  box-shadow: inset -8px -10px 26px rgba(0, 0, 0, 0.2);
  transform: translateZ(22px);
}

/* ---------- BRAÇOS (do ombro até a mão; 2 planos cruzados dão volume) ---------- */
.rp-braco {
  position: absolute;
  height: 0;
  transform-style: preserve-3d;
  transform-origin: 0 0;
}

.rp-braco b {
  position: absolute;
  left: 0;
  top: -11px;
  width: var(--len, 80px);
  height: 22px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--rp-topo), var(--rp-lado));
}

.rp-braco b + b {
  transform: rotateX(90deg);
  background: linear-gradient(180deg, var(--rp-frente), var(--rp-fundo));
}

/* ---------- PLACA (letreiro de lâmpadas) ---------- */
.rp-placa {
  position: absolute;
  top: 252px;
  left: 50%;
  width: 300px;
  height: 156px;
  margin-left: -150px;
  transform-style: preserve-3d;
  transform: translateZ(64px) rotateX(-6deg);
}

.rp-casca-placa {
  width: 300px;
  height: 156px;
  margin: -78px 0 0 -150px;
}

.rp-casca-placa i {
  border-radius: 16px;
  background: var(--c, #2b2566);
}

.rp-placa-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(160deg, var(--rp-frente), var(--rp-fundo));
  box-shadow: inset -4px -6px 14px rgba(0, 0, 0, 0.25), 0 18px 30px rgba(30, 27, 75, 0.28);
  transform: translateZ(1px);
}

.rp-placa-painel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: radial-gradient(120% 120% at 50% 40%, #1c1a45 0%, #0b0a24 70%);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
}

/* lâmpadas da moldura (posicionadas pelo JS sobre a borda) */
.rp-lampada {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--rp-luz-off);
  animation: rpCorre 1.2s steps(1) infinite;
  animation-delay: calc(var(--n) * -0.4s);
}

@keyframes rpCorre {
  0% {
    background: var(--rp-luz);
    box-shadow: 0 0 5px var(--rp-luz-forte), 0 0 11px rgba(255, 176, 32, 0.65);
  }
  33%, 100% {
    background: #7a5a1c;
    box-shadow: none;
  }
}

/* número em matriz de lâmpadas (5 x 7 por dígito) */
.rp-numero {
  display: flex;
  gap: 14px;
}

.rp-digito {
  display: grid;
  grid-template-columns: repeat(5, 8px);
  grid-auto-rows: 8px;
  gap: 2px;
}

.rp-digito span {
  border-radius: 50%;
  background: var(--rp-luz-off);
  transition: background 0.18s ease, box-shadow 0.18s ease;
  transition-delay: var(--d, 0ms);
}

.robo-placa.aceso .rp-digito span.on {
  background: var(--rp-luz);
  box-shadow: 0 0 4px var(--rp-luz-forte), 0 0 9px rgba(255, 176, 32, 0.55);
}

.rp-legenda {
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c7d2fe;
}

/* ---------- MÃOS (seguram as laterais da placa) ---------- */
.rp-mao {
  position: absolute;
  top: 50px;
  width: 34px;
  height: 50px;
  transform-style: preserve-3d;
}

.rp-mao.esq { left: -20px; }
.rp-mao.dir { right: -20px; }

.rp-mao i {
  border-radius: 16px;
  background: var(--c, var(--rp-lado));
}

/* ---------- tamanhos ---------- */
@media (max-width: 1080px) {
  .robo-placa { --rp-escala: 0.54; }
}

@media (max-width: 600px) {
  .robo-placa { --rp-escala: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-flutua,
  .rp-lampada,
  .rp-led {
    animation: none;
  }

  .rp-lampada {
    background: var(--rp-luz);
  }

  .rp-mira,
  .rp-cabeca,
  .rp-rosto {
    transition: none;
  }
}

/* Os braços ficam atrás da placa e, em alguns ângulos, atravessavam o letreiro
   como um traço; as mãos segurando as laterais já contam a história. */
.rp-braco {
  display: none;
}
