/* Global Premium Emerald-Lime Fixed Background Effect (All Public Pages) */
html {
  background: #07120C;
}

body {
  background: transparent;
}

#global-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 75% 42%, rgba(22, 163, 74, 0.16) 0%, rgba(7, 18, 12, 0.92) 52%, #07120C 100%);
}

/* Soft ambient lime glow on edges */
.global-glow {
  position: absolute;
  right: -8%;
  top: 12%;
  width: min(680px, 75vw);
  height: min(680px, 75vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(132, 204, 22, 0.16) 0%, rgba(22, 163, 74, 0.08) 42%, transparent 72%);
  filter: blur(28px);
  animation: globalGlowPulse 10s ease-in-out infinite alternate;
}

@keyframes globalGlowPulse {
  0% { opacity: 0.72; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1.04); }
}

/* Large glowing semi-transparent D shape on right side */
.global-d-shape {
  position: absolute;
  right: 7%;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(220px, 32vw, 440px);
  line-height: 1;
  user-select: none;
  color: rgba(22, 163, 74, 0.12);
  -webkit-text-stroke: 2px rgba(132, 204, 22, 0.34);
  text-shadow:
    0 0 38px rgba(132, 204, 22, 0.25),
    0 0 90px rgba(22, 163, 74, 0.22);
  animation: globalDPulse 12s ease-in-out infinite alternate;
}

@keyframes globalDPulse {
  0% {
    transform: translateY(-50%) rotateY(-8deg) scale(0.98);
    filter: drop-shadow(0 0 18px rgba(132, 204, 22, 0.2));
  }
  100% {
    transform: translateY(-52%) rotateY(8deg) scale(1.02);
    filter: drop-shadow(0 0 32px rgba(163, 230, 53, 0.35));
  }
}

/* Thin lime orbiting rings rotating smoothly (24s linear infinite) */
.global-orbit {
  position: absolute;
  right: calc(7% - 55px);
  top: 50%;
  border-radius: 50%;
  border: 1px solid rgba(132, 204, 22, 0.22);
  box-shadow: 0 0 18px rgba(132, 204, 22, 0.08);
  pointer-events: none;
}

.global-orbit.orbit-1 {
  width: clamp(320px, 40vw, 520px);
  height: clamp(320px, 40vw, 520px);
  margin-top: calc(clamp(320px, 40vw, 520px) / -2);
  border-top-color: rgba(163, 230, 53, 0.52);
  border-right-color: rgba(74, 222, 128, 0.28);
  animation: globalOrbitSpin 24s linear infinite;
}

.global-orbit.orbit-2 {
  width: clamp(390px, 48vw, 630px);
  height: clamp(390px, 48vw, 630px);
  right: calc(7% - 110px);
  margin-top: calc(clamp(390px, 48vw, 630px) / -2);
  border-style: dashed;
  border-color: rgba(132, 204, 22, 0.16);
  border-bottom-color: rgba(163, 230, 53, 0.42);
  animation: globalOrbitSpinReverse 24s linear infinite;
}

@keyframes globalOrbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes globalOrbitSpinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

#global-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Hide flat CSS D/orbits when real 3D Three.js canvas is active so there is no overlap */
body:has(#ascend-canvas-wrap) .global-d-shape,
body:has(#ascend-canvas-wrap) .global-orbit,
body:has(#ascend-canvas-wrap) #global-particles {
  display: none;
}

/* Keep fixed navbar pinned at top and page content cleanly above 3D & #global-bg */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
}

main.page-main,
main.ascend-driver {
  position: relative;
  z-index: 2;
}

.site-footer {
  position: relative;
  z-index: 15;
}

/* Mobile < 768px: static dark gradient + D shape only (fast load & smooth scroll) */
@media (max-width: 767px) {
  .global-d-shape {
    right: 50%;
    transform: translate(50%, -50%);
    font-size: 240px;
    animation: none;
  }
  .global-orbit,
  #global-particles {
    display: none;
  }
  .global-glow {
    animation: none;
  }
}

/* Reduced motion: completely static */
html[data-theme="light"] {
  background: #f4f9f6;
}

html[data-theme="light"] #global-bg {
  background: radial-gradient(circle at 75% 42%, rgba(22, 163, 74, 0.08) 0%, rgba(244, 249, 246, 0.94) 55%, #ffffff 100%);
}

html[data-theme="light"] .global-glow {
  background: radial-gradient(circle, rgba(22, 163, 74, 0.14) 0%, rgba(132, 204, 22, 0.07) 45%, transparent 72%);
}

html[data-theme="light"] .global-d-shape {
  color: rgba(22, 163, 74, 0.08);
  -webkit-text-stroke: 2px rgba(21, 128, 61, 0.25);
  text-shadow: 0 0 28px rgba(22, 163, 74, 0.14);
}

html[data-theme="light"] .global-orbit {
  border-color: rgba(21, 128, 61, 0.18);
  box-shadow: 0 0 14px rgba(22, 163, 74, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .global-glow,
  .global-d-shape,
  .global-orbit {
    animation: none !important;
  }
  #global-particles {
    display: none !important;
  }
}
