

:root {
  --ai-blue: #0877c9;
  --ai-cyan: #42d8ef;
  --ai-green: #76d64f;
  --ai-yellow: #f5d63e;
  --ai-stage-width: 1122;
  --ai-stage-height: 1402;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(121, 224, 240, 0.16), transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #f7fcfb 100%);
  overflow-x: hidden;
}

.ai-demo {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.ai-visual-section {
  width: min(100%, 940px);
}

.ai-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1122 / 1402;
  overflow: hidden;
  isolation: isolate;
  transform-style: preserve-3d;
  transition: transform 180ms ease-out;
  filter: drop-shadow(0 30px 42px rgba(10, 83, 118, 0.12));
}

.ai-stage::after {
  content: "";
  position: absolute;
  inset: 4% 5%;
  z-index: 20;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(255, 255, 255, 0.34) 78%,
    rgba(255, 255, 255, 0.78) 100%
  );
}

.ai-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}

.ai-layer--back {
  z-index: 0;
}

.ai-layer--art {
  z-index: 2;
}

.ai-layer--effects {
  z-index: 5;
}

.ai-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  animation: artFloat 7s ease-in-out infinite;
  will-change: transform;
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.28;
  animation: glowDrift 8s ease-in-out infinite alternate;
}

.ambient-glow--one {
  width: 32%;
  aspect-ratio: 1;
  left: 13%;
  top: 12%;
  background: rgba(74, 215, 240, 0.46);
}

.ambient-glow--two {
  width: 38%;
  aspect-ratio: 1;
  right: 8%;
  top: 34%;
  background: rgba(119, 220, 82, 0.38);
  animation-delay: -3s;
}

.ambient-glow--three {
  width: 30%;
  aspect-ratio: 1;
  left: 33%;
  bottom: 8%;
  background: rgba(246, 214, 62, 0.30);
  animation-delay: -5s;
}

.ai-core-glow {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 38%;
  aspect-ratio: 0.82;
  transform: translate(-50%, -50%);
  border-radius: 42%;
  background:
    radial-gradient(circle at 50% 42%,
      rgba(255, 255, 255, 0.00) 0 35%,
      rgba(71, 221, 247, 0.10) 52%,
      rgba(37, 140, 226, 0.22) 72%,
      transparent 78%);
  filter: blur(9px);
  mix-blend-mode: screen;
  animation: aiPulse 3.5s ease-in-out infinite;
}

.ai-flow-map {
  z-index: 4;
  overflow: visible;
  opacity: 0.68;
  mix-blend-mode: screen;
}

.flow-line {
  fill: none;
  stroke: rgba(120, 237, 255, 0.75);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 5 24;
  filter: url(#flowGlow);
  animation: flowMove 4s linear infinite;
}

.flow-line--two {
  animation-duration: 5.5s;
  animation-delay: -1.5s;
}

.flow-line--three {
  animation-duration: 6.5s;
  animation-delay: -3s;
}

.flow-line--four {
  animation-duration: 5s;
  animation-delay: -2s;
}

.flow-node {
  fill: #fff;
  stroke: rgba(58, 217, 245, 0.88);
  stroke-width: 7;
  filter: url(#flowGlow);
  animation: nodeBlink 2.2s ease-in-out infinite;
}

.flow-node--two {
  animation-delay: -0.6s;
}

.flow-node--three {
  animation-delay: -1.2s;
}

.flow-node--four {
  animation-delay: -1.8s;
}

.scan-ring {
  position: absolute;
  border: 2px solid rgba(87, 225, 247, 0.66);
  border-radius: 50%;
  box-shadow:
    0 0 12px rgba(87, 225, 247, 0.52),
    inset 0 0 12px rgba(87, 225, 247, 0.18);
  opacity: 0;
  animation: scanPulse 3.2s ease-out infinite;
}

.scan-ring--one {
  width: 20%;
  aspect-ratio: 1;
  left: 9%;
  top: 36%;
}

.scan-ring--two {
  width: 18%;
  aspect-ratio: 1;
  right: 8%;
  top: 40%;
  animation-delay: -1.1s;
}

.scan-ring--three {
  width: 17%;
  aspect-ratio: 1;
  left: 23%;
  bottom: 12%;
  animation-delay: -2.1s;
}

.pulse {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 0 0 0 rgba(57, 220, 244, 0.70),
    0 0 18px rgba(57, 220, 244, 0.90);
  animation: signalPulse 2.4s ease-out infinite;
}

.pulse--one {
  left: 72%;
  top: 31%;
}

.pulse--two {
  left: 80%;
  top: 66%;
  animation-delay: -0.8s;
}

.pulse--three {
  left: 39%;
  top: 71%;
  animation-delay: -1.6s;
}

.data-particle {
  position: absolute;
  width: clamp(4px, 0.65vw, 8px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 0 9px rgba(66, 216, 239, 0.95),
    0 0 18px rgba(8, 119, 201, 0.70);
  opacity: 0;
  animation: particleTravel 5.8s linear infinite;
}

.particle--1  { left: 48%; top: 21%; --mx: 70px;  --my: 150px; animation-delay: -0.4s; }
.particle--2  { left: 58%; top: 26%; --mx: 95px;  --my: 120px; animation-delay: -1.4s; }
.particle--3  { left: 66%; top: 38%; --mx: 60px;  --my: 180px; animation-delay: -2.1s; }
.particle--4  { left: 73%; top: 52%; --mx: 45px;  --my: 155px; animation-delay: -3.2s; }
.particle--5  { left: 62%; top: 68%; --mx: -45px; --my: 160px; animation-delay: -4.1s; }
.particle--6  { left: 46%; top: 72%; --mx: -60px; --my: 145px; animation-delay: -0.8s; }
.particle--7  { left: 33%; top: 63%; --mx: -75px; --my: -120px; animation-delay: -2.8s; }
.particle--8  { left: 26%; top: 49%; --mx: 35px;  --my: -145px; animation-delay: -4.8s; }
.particle--9  { left: 37%; top: 33%; --mx: 52px;  --my: 130px; animation-delay: -1.8s; }
.particle--10 { left: 55%; top: 57%; --mx: 95px;  --my: 95px;  animation-delay: -3.8s; }

.shine-sweep {
  position: absolute;
  width: 18%;
  height: 90%;
  top: 5%;
  left: -30%;
  transform: rotate(16deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.46),
    rgba(255, 255, 255, 0.05),
    transparent
  );
  filter: blur(5px);
  mix-blend-mode: screen;
  animation: shineMove 7.5s ease-in-out infinite;
}

.flying-drone {
  position: absolute;
  width: 7%;
  min-width: 36px;
  right: 17%;
  top: 12%;
  color: #0877c9;
  filter: drop-shadow(0 7px 8px rgba(12, 89, 143, 0.24));
  animation: droneFly 6s ease-in-out infinite;
}

.ai-stage.is-paused *,
.ai-stage.is-paused *::before,
.ai-stage.is-paused *::after {
  animation-play-state: paused !important;
}

/* 動畫 */
@keyframes artFloat {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -8px, 0) scale(1.006);
  }
}

@keyframes glowDrift {
  from {
    transform: translate3d(-8px, -8px, 0) scale(0.94);
  }
  to {
    transform: translate3d(12px, 10px, 0) scale(1.08);
  }
}

@keyframes aiPulse {
  0%, 100% {
    opacity: 0.34;
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    opacity: 0.90;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes flowMove {
  to {
    stroke-dashoffset: -116;
  }
}

@keyframes nodeBlink {
  0%, 100% {
    opacity: 0.40;
    transform: scale(0.82);
    transform-origin: center;
  }
  50% {
    opacity: 1;
    transform: scale(1.25);
  }
}

@keyframes scanPulse {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  26% {
    opacity: 0.78;
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@keyframes signalPulse {
  0% {
    opacity: 0.95;
    box-shadow:
      0 0 0 0 rgba(57, 220, 244, 0.72),
      0 0 18px rgba(57, 220, 244, 0.90);
  }
  75% {
    opacity: 0.72;
    box-shadow:
      0 0 0 24px rgba(57, 220, 244, 0),
      0 0 24px rgba(57, 220, 244, 0.64);
  }
  100% {
    opacity: 0;
    box-shadow:
      0 0 0 30px rgba(57, 220, 244, 0),
      0 0 6px rgba(57, 220, 244, 0);
  }
}

@keyframes particleTravel {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.45);
  }
  16% {
    opacity: 0.88;
  }
  72% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--mx), var(--my), 0) scale(1.3);
  }
}

@keyframes shineMove {
  0%, 18% {
    left: -30%;
    opacity: 0;
  }
  35% {
    opacity: 0.78;
  }
  62% {
    opacity: 0.25;
  }
  78%, 100% {
    left: 115%;
    opacity: 0;
  }
}

@keyframes droneFly {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(-2deg);
  }
  28% {
    transform: translate3d(18px, -9px, 0) rotate(3deg);
  }
  58% {
    transform: translate3d(-10px, 8px, 0) rotate(-4deg);
  }
  78% {
    transform: translate3d(10px, 4px, 0) rotate(2deg);
  }
}

/* 手機版降低動畫位移，避免畫面晃動太大 */
@media (max-width: 767.98px) {
  .ai-demo {
    min-height: auto;
    padding: 12px 4px;
  }

  .ai-visual-section {
    width: 100%;
  }

  .ai-stage {
    filter: drop-shadow(0 18px 24px rgba(10, 83, 118, 0.10));
  }

  .ai-flow-map {
    opacity: 0.52;
  }

  .data-particle {
    animation-duration: 6.8s;
  }
}

/* 使用者設定減少動態時，自動停止大部分動畫 */
@media (prefers-reduced-motion: reduce) {
  .ai-stage,
  .ai-stage *,
  .ai-stage *::before,
  .ai-stage *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
