/*
 * Homepage digital-twin hero — pure CSS 3D (perspective + preserve-3d),
 * no WebGL/Three.js dependency. Enqueued only on the front page (see
 * gta_enqueue_assets() in functions.php) so inner pages never pay for it.
 *
 * An isometric read-zone: a gate beam sweeps across a rack of tagged
 * crates; each tag's pulse is phase-matched (via inline animation-delay
 * in front-page.php) to the moment the beam crosses its column, so the
 * glow reads as a live read event rather than a decorative loop.
 */
.twin-wrap { margin-top: 40px; }

.twin-stage {
  perspective: 1000px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.twin-stage:active { cursor: grabbing; }

.twin-scene {
  position: relative;
  width: 1px;
  height: 1px;
  transform-style: preserve-3d;
  transform: rotateX(55deg) rotateZ(-38deg);
  transition: transform .3s ease-out;
}

.twin-floor {
  position: absolute;
  width: 440px; height: 300px;
  left: -220px; top: -150px;
  background-image:
    linear-gradient(var(--accent-cyan-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-cyan-dim) 1px, transparent 1px);
  background-size: 36px 36px;
  border: 1px solid var(--accent-cyan-dim);
  box-shadow: inset 0 0 60px rgba(51,225,255,0.07);
}

.twin-gate {
  position: absolute;
  width: 2px; height: 300px;
  left: -221px; top: -150px;
  transform: translateZ(60px);
  background: linear-gradient(180deg, transparent, rgba(51,225,255,0.5), transparent);
}
.twin-gate::before {
  content: "GATE";
  position: absolute; top: -22px; left: -16px;
  font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.1em;
  color: var(--accent-cyan); opacity: 0.7;
}

.twin-crate {
  position: absolute;
  width: 48px; height: 48px;
  left: calc(var(--x) - 24px); top: calc(var(--y) - 24px);
  transform-style: preserve-3d;
  transform: translateZ(24px);
}
.twin-crate .face {
  position: absolute; width: 48px; height: 48px;
  background: rgba(10,22,28,0.92);
  border: 1px solid var(--accent-cyan-dim);
}
.twin-crate .face.top { transform: translateZ(24px); background: rgba(22,44,52,0.92); }
.twin-crate .face.front { transform: rotateX(-90deg) translateZ(24px); background: rgba(6,14,18,0.95); }
.twin-crate .face.side { transform: rotateY(90deg) translateZ(24px); background: rgba(4,10,13,0.95); }

.twin-tag {
  position: absolute;
  width: 8px; height: 8px;
  left: 20px; top: -14px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 4px 1px var(--accent-cyan-dim);
  transform: translateZ(48px);
  animation: gta-twin-pulse 4s ease-in-out infinite;
}
@keyframes gta-twin-pulse {
  0%, 88%, 100% { opacity: .35; box-shadow: 0 0 4px 1px var(--accent-cyan-dim); }
  92% { opacity: 1; box-shadow: 0 0 16px 7px var(--accent-cyan); }
}

.twin-beam {
  position: absolute;
  width: 5px; height: 300px;
  left: -222px; top: -150px;
  transform: translateZ(30px) translateX(-220px);
  background: linear-gradient(180deg, transparent, var(--accent-cyan), transparent);
  opacity: .7;
  box-shadow: 0 0 26px 6px rgba(51,225,255,0.5);
  animation: gta-twin-sweep 4s linear infinite;
}
@keyframes gta-twin-sweep {
  0% { transform: translateZ(30px) translateX(-220px); }
  100% { transform: translateZ(30px) translateX(220px); }
}

.twin-caption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-on-dark-dim);
  margin-top: 12px;
}
.twin-caption b { color: var(--accent-cyan); }

.telemetry { display: flex; gap: 0; margin-top: 28px; border: 1px solid var(--glass-border); }
.tcell { flex: 1; padding: 14px 18px; border-right: 1px solid var(--glass-border); }
.tcell:last-child { border-right: none; }
.tcell b { display: block; font-size: 1.25rem; color: var(--accent-cyan); font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.tcell span { font-size: 0.65rem; color: var(--text-on-dark-dim); letter-spacing: 0.06em; text-transform: uppercase; }

@media (max-width: 900px) {
  .twin-stage { height: 230px; transform: scale(0.72); transform-origin: top center; }
  .telemetry { flex-wrap: wrap; }
}

/* Static-scene fallback: no sweep, no pulse — one clean frame. The scene
   itself (floor + crates + fixed isometric angle) is pure CSS and renders
   with or without JS; only mouse-orbit and the telemetry readout require it. */
@media (prefers-reduced-motion: reduce) {
  .twin-tag, .twin-beam { animation: none !important; opacity: .6; }
  .twin-scene { transition: none; }
}
