/**
 * Background-only IoT décor (inner pages).
 * - Only .iot-ambient* selectors (no cards / buttons / forms / banners)
 * - pointer-events: none — never intercepts clicks/taps
 * - z-index: -1 inside main — paints under page UI, above page canvas
 * - Edge/corner placement so the content column stays clear
 * - Motion: transform / opacity / stroke-dashoffset only
 */

body.page-inner > main {
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.iot-ambient,
.iot-ambient * {
  pointer-events: none !important;
}

.iot-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  contain: strict;
  /* Keep décor in side/corner gutters — leave the content column clear */
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 12%,
    transparent 22%,
    transparent 78%,
    #000 88%,
    #000 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 12%,
    transparent 22%,
    transparent 78%,
    #000 88%,
    #000 100%
  );
}

.iot-ambient__aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
}

.iot-ambient__aurora--tr {
  top: -16%;
  right: -10%;
  width: min(48vw, 560px);
  height: min(48vw, 560px);
  background: radial-gradient(circle, rgba(31, 90, 188, 0.38) 0%, transparent 70%);
  animation: iot-amb-drift 18s ease-in-out infinite alternate;
}

.iot-ambient__aurora--bl {
  bottom: -18%;
  left: -12%;
  width: min(52vw, 600px);
  height: min(52vw, 600px);
  background: radial-gradient(circle, rgba(94, 179, 255, 0.2) 0%, rgba(240, 196, 60, 0.07) 50%, transparent 72%);
  animation: iot-amb-drift 22s ease-in-out infinite alternate-reverse;
}

.iot-ambient__svg {
  position: absolute;
  overflow: visible;
}

.iot-ambient__svg--tr {
  top: 8%;
  right: 0;
  width: min(28vw, 320px);
  height: auto;
  opacity: 0.55;
  animation: iot-amb-float 9s ease-in-out infinite alternate;
}

.iot-ambient__svg--bl {
  bottom: 10%;
  left: 0;
  width: min(24vw, 280px);
  height: auto;
  opacity: 0.45;
  animation: iot-amb-float 11s ease-in-out infinite alternate-reverse;
}

.iot-ambient__svg--signal {
  right: 1%;
  bottom: 14%;
  width: min(20vw, 200px);
  height: auto;
  opacity: 0.5;
  animation: iot-amb-signal-bob 8s ease-in-out infinite alternate;
}

/* Flowing network links */
.iot-ambient__links path {
  animation: iot-amb-dash 4.5s linear infinite;
}

.iot-ambient__links--slow path {
  animation-duration: 7s;
  animation-direction: reverse;
}

.iot-ambient__pulse {
  transform-origin: center;
  transform-box: fill-box;
  animation: iot-amb-node 2.8s ease-in-out infinite;
}

.iot-ambient__nodes .iot-ambient__pulse:nth-child(2) { animation-delay: 0.35s; }
.iot-ambient__nodes .iot-ambient__pulse:nth-child(3) { animation-delay: 0.7s; }
.iot-ambient__nodes .iot-ambient__pulse:nth-child(4) { animation-delay: 1.05s; }
.iot-ambient__nodes .iot-ambient__pulse:nth-child(5) { animation-delay: 1.4s; }
.iot-ambient__nodes .iot-ambient__pulse:nth-child(6) { animation-delay: 1.75s; }
.iot-ambient__nodes .iot-ambient__pulse:nth-child(7) { animation-delay: 2.1s; }

.iot-ambient__ring {
  transform-origin: 110px 110px;
  animation: iot-amb-ring 4.2s ease-out infinite;
}

.iot-ambient__ring--2 { animation-delay: 0.7s; }
.iot-ambient__ring--3 { animation-delay: 1.4s; }
.iot-ambient__ring--4 { animation-delay: 2.1s; }

.iot-ambient__core {
  transform-origin: center;
  transform-box: fill-box;
  animation: iot-amb-core 2.4s ease-in-out infinite;
}

@keyframes iot-amb-drift {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.75; }
  to { transform: translate3d(4%, 5%, 0) scale(1.08); opacity: 1; }
}

@keyframes iot-amb-float {
  from { transform: translate3d(0, 0, 0); opacity: 0.4; }
  to { transform: translate3d(-10px, 14px, 0); opacity: 0.65; }
}

@keyframes iot-amb-signal-bob {
  from { transform: translate3d(0, 0, 0) scale(0.96); opacity: 0.4; }
  to { transform: translate3d(-6px, -10px, 0) scale(1.04); opacity: 0.6; }
}

@keyframes iot-amb-dash {
  to { stroke-dashoffset: -64; }
}

@keyframes iot-amb-node {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.7); }
}

@keyframes iot-amb-ring {
  0% { opacity: 0.55; transform: scale(0.88); }
  70% { opacity: 0; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1.14); }
}

@keyframes iot-amb-core {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.45); }
}

@media (max-width: 991px) {
  .iot-ambient {
    -webkit-mask-image: linear-gradient(
      90deg,
      #000 0%,
      #000 8%,
      transparent 18%,
      transparent 82%,
      #000 92%,
      #000 100%
    );
    mask-image: linear-gradient(
      90deg,
      #000 0%,
      #000 8%,
      transparent 18%,
      transparent 82%,
      #000 92%,
      #000 100%
    );
  }
  .iot-ambient__svg--tr { width: min(36vw, 240px); opacity: 0.42; }
  .iot-ambient__svg--bl { width: min(32vw, 200px); opacity: 0.34; }
  .iot-ambient__svg--signal { width: min(28vw, 160px); opacity: 0.38; }
}

@media (max-width: 575px) {
  .iot-ambient__svg--bl,
  .iot-ambient__svg--signal { display: none; }
  .iot-ambient__svg--tr { opacity: 0.38; top: 12%; }
}

@media (prefers-reduced-motion: reduce) {
  .iot-ambient__aurora,
  .iot-ambient__svg--tr,
  .iot-ambient__svg--bl,
  .iot-ambient__svg--signal,
  .iot-ambient__links path,
  .iot-ambient__pulse,
  .iot-ambient__ring,
  .iot-ambient__core {
    animation: none !important;
  }
}

@media (forced-colors: active) {
  .iot-ambient { display: none; }
}
