/* ==========================================================================
   THE CASTRO — Cena 3D do hero (no lugar do vídeo)
   Três navegadores e um celular com sites reais de clientes, em profundidade.
   CSS 3D puro (sem WebGL): leve e nítido. O giro com o mouse fica em
   js/hero3d.js, que só mexe nas variáveis --rx, --ry e --sx.
   ========================================================================== */

.hero-media.hero-3d {
  aspect-ratio: 6 / 5;
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
}

.h3d-palco {
  position: absolute;
  inset: 0;
  perspective: 1800px;
  perspective-origin: 50% 40%;
}

.h3d-cena {
  --rx: 8deg;
  --ry: -16deg;
  --sx: 30%;
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  will-change: transform;
}

/* luz da marca atrás e sombra no chão */
.h3d-luz {
  position: absolute;
  left: 8%;
  top: 6%;
  width: 84%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(81, 170, 150, .45), rgba(50, 143, 146, .18) 55%, transparent 75%);
  filter: blur(30px);
  transform: translateZ(-260px);
  pointer-events: none;
}
.h3d-chao {
  position: absolute;
  left: 12%;
  bottom: 2%;
  width: 76%;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(1, 28, 29, .28), transparent);
  filter: blur(14px);
  transform: rotateX(80deg) translateZ(-40px);
  pointer-events: none;
}

/* janelas de navegador */
.h3d-tela {
  position: absolute;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--tc-primario);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .07),
    0 30px 60px -18px rgba(1, 28, 29, .45),
    0 60px 120px -40px rgba(1, 28, 29, .35);
  backface-visibility: hidden;
}
.h3d-barra {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  background: var(--tc-primario);
}
.h3d-barra b { width: 7px; height: 7px; border-radius: 50%; background: rgba(242, 240, 236, .22); }
.h3d-barra b:nth-child(1) { background: #ff5f57; }
.h3d-barra b:nth-child(2) { background: #febc2e; }
.h3d-barra b:nth-child(3) { background: #28c840; }
.h3d-barra span {
  margin-left: 6px;
  flex: 1;
  min-width: 0;
  font-family: var(--tc-sans);
  font-size: 9.5px;
  line-height: 15px;
  color: rgba(242, 240, 236, .6);
  background: rgba(242, 240, 236, .08);
  border-radius: 5px;
  padding: 0 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.h3d-tela img,
.h3d-cel img { display: block; width: 100%; height: auto; }

/* reflexo de vidro que acompanha o giro */
.h3d-tela::after,
.h3d-cel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent calc(var(--sx) - 25%), rgba(255, 255, 255, .22) var(--sx), transparent calc(var(--sx) + 22%));
  mix-blend-mode: soft-light;
  pointer-events: none;
}

/* posições na profundidade (cada uma flutua num ritmo) */
.h3d-tela--fundo-esq {
  width: 54%; left: -9%; top: -3%;
  transform: translateZ(-170px) rotateY(10deg);
  animation: h3dEntra 1.4s var(--tc-ease) .15s both, h3dFlutua 8s ease-in-out 1.6s infinite;
}
.h3d-tela--fundo-dir {
  width: 50%; left: 52%; top: 40%;
  transform: translateZ(-80px) rotateY(-4deg);
  animation: h3dEntra 1.4s var(--tc-ease) .3s both, h3dFlutua 9s ease-in-out 2s infinite;
}
.h3d-tela--frente {
  width: 66%; left: 16%; top: 21%;
  transform: translateZ(90px);
  animation: h3dEntra 1.4s var(--tc-ease) 0s both, h3dFlutua 7s ease-in-out 1.4s infinite;
}

/* celular */
.h3d-cel {
  position: absolute;
  margin: 0;
  width: 17%;
  left: 75%;
  top: 47%;
  padding: 5px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--tc-primario);
  box-shadow: 0 0 0 1.5px rgba(242, 240, 236, .14), 0 30px 50px -14px rgba(1, 28, 29, .55);
  transform: translateZ(190px) rotateY(-8deg);
  animation: h3dEntra 1.4s var(--tc-ease) .45s both, h3dFlutua 6.5s ease-in-out 1.9s infinite;
}
.h3d-cel img { border-radius: 17px; aspect-ratio: 390 / 844; object-fit: cover; object-position: top; }
.h3d-cel::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 50%;
  translate: -50% 0;
  width: 30%;
  height: 6px;
  border-radius: 9px;
  background: var(--tc-primario);
}

/* selo de vidro */
.h3d-selo {
  position: absolute;
  left: 4%;
  bottom: 9%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .7);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 14px 30px -10px rgba(1, 28, 29, .3);
  font-family: var(--tc-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tc-primario);
  white-space: nowrap;
  transform: translateZ(230px);
  animation: h3dEntra 1.4s var(--tc-ease) .6s both, h3dFlutua 7.5s ease-in-out 2.1s infinite;
}
.h3d-selo i { width: 8px; height: 8px; border-radius: 50%; background: var(--tc-verde); animation: cta-pulse 2s infinite; }

@keyframes h3dEntra {
  from { opacity: 0; scale: .86; }
  to   { opacity: 1; scale: 1; }
}
@keyframes h3dFlutua {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -12px; }
}

@media (max-width: 1024px) {
  /* celular e tablet: a cena vem primeiro, o texto depois */
  .hero-media.hero-3d { order: -1; width: 100%; max-width: 680px; margin: 0 auto; }
}
@media (max-width: 767px) {
  .hero-media.hero-3d { aspect-ratio: 5 / 4; }
  .tem-menu-home .hero { padding-top: 84px; }
  .h3d-palco { perspective: 2600px; }
  .h3d-cena { inset: 0 8% 0 2%; }
  .h3d-tela--fundo-dir { width: 46%; }
  .h3d-barra { height: 16px; padding: 0 6px; gap: 4px; }
  .h3d-barra b { width: 5px; height: 5px; }
  .h3d-barra span { display: none; }
  .h3d-cel { padding: 3px; border-radius: 14px; }
  .h3d-cel img { border-radius: 11px; }
  .h3d-cel::before { top: 6px; height: 4px; }
  .h3d-selo { font-size: 11px; padding: 7px 10px; bottom: 4%; }
}

@media (prefers-reduced-motion: reduce) {
  .h3d-tela, .h3d-cel, .h3d-selo { animation: none !important; }
}
