/* TARS visual treatment: background, orb, and smoked glass only. */

.ambient {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #030610 url('/assets/tars-flow-bg.svg') center / cover no-repeat !important;
}

/* Two independent light fields, separate from the stationary artwork. */
.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  will-change: transform;
}

.ambient::before {
  background-image:
    radial-gradient(ellipse at 25% 45%,
      rgb(255 24 66 / 32%) 0%,
      rgb(255 24 66 / 12%) 25%,
      transparent 52%);
  filter: blur(42px);
  animation: tars-red-glide 72s ease-in-out infinite alternate;
}

.ambient::after {
  background-image:
    radial-gradient(ellipse at 75% 55%,
      rgb(0 105 255 / 30%) 0%,
      rgb(0 105 255 / 11%) 28%,
      transparent 54%);
  filter: blur(48px);
  animation: tars-blue-glide 91s ease-in-out infinite alternate;
}

/* Keep the content above the light fields. */
.ambient .glass-panel {
  position: relative;
  z-index: 2;
  background:
    linear-gradient(
      115deg,
      rgb(5 7 14 / 64%),
      rgb(3 7 15 / 57%) 50%,
      rgb(4 8 17 / 64%)
    ) padding-box,
    linear-gradient(
      115deg,
      rgb(255 64 92 / 82%),
      rgb(115 45 72 / 55%) 25%,
      rgb(40 55 83 / 48%) 55%,
      rgb(8 125 255 / 78%) 88%,
      rgb(84 202 255 / 55%)
    ) border-box !important;
  -webkit-backdrop-filter: blur(18px) saturate(130%) !important;
  backdrop-filter: blur(18px) saturate(130%) !important;
  box-shadow:
    -8px 8px 38px rgb(255 35 57 / 9%),
    8px 8px 42px rgb(8 125 255 / 10%),
    inset 0 1px 1px rgb(255 255 255 / 13%) !important;
}

/* Retain the supplied orb image and existing state/audio integration. */
.ambient .voice-orb {
  background: transparent url('/assets/tars-magic-orb.webp')
    center / contain no-repeat !important;
  border: 0 !important;
  overflow: visible !important;
  box-shadow:
    0 0 calc(14px + var(--voice-energy, 0) * 28px) rgb(8 125 255 / 31%),
    0 0 calc(10px + var(--voice-energy, 0) * 22px) rgb(255 35 72 / 27%) !important;
}

.ambient .voice-orb > .orb-core,
.ambient .voice-orb > .orb-ribbon,
.ambient .voice-orb > .orb-glass,
.ambient .voice-orb > .orb-shine {
  display: none !important;
}

.ambient .voice-orb[data-state="speaking"] {
  filter: saturate(1.12) brightness(1.06);
}

@keyframes tars-red-glide {
  from { transform: translate3d(-2.5%, -0.5%, 0); }
  to   { transform: translate3d(2.5%, 0.5%, 0); }
}

@keyframes tars-blue-glide {
  from { transform: translate3d(2%, 0.5%, 0); }
  to   { transform: translate3d(-2%, -0.5%, 0); }
}

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

/* FINAL MOTION FIX: freeze the artwork; move only the two light fields. */
.ambient {
  background-image: url('/assets/tars-flow-bg.svg') !important;
  background-color: #030610 !important;
  background-position: center !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
}

.ambient::before {
  animation: none !important;
  transform: none !important;
  opacity: .35 !important;
}

.ambient .glow-red,
.ambient .glow-blue {
  z-index: 1 !important;
  width: 70vw !important;
  height: 70vw !important;
  max-width: 900px !important;
  max-height: 900px !important;
  filter: blur(100px) !important;
  opacity: .22 !important;
  will-change: transform;
}

.ambient .glow-red {
  animation: tars-red-glide-final 48s linear infinite alternate !important;
}

.ambient .glow-blue {
  animation: tars-blue-glide-final 63s linear infinite alternate !important;
}

@keyframes tars-red-glide-final {
  from { transform: translate3d(-4vw, 0, 0); }
  to   { transform: translate3d(4vw, -1vh, 0); }
}

@keyframes tars-blue-glide-final {
  from { transform: translate3d(3vw, 1vh, 0); }
  to   { transform: translate3d(-4vw, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ambient .glow-red,
  .ambient .glow-blue {
    animation: none !important;
  }
}
