/* Atmosphere: grainy glowing orbs in Sandspur's tones that bloom in as each
   section arrives and dim again once you have passed it. Each orb belongs to
   a section (placed by js/atmosphere.js), so only one or two are ever lit.
   The grain is a mask on the glow itself: the black ground stays clean. */

:root {
  --orb-sand: 230, 184, 112;
  --orb-copper: 212, 126, 66;
  --orb-cream: 246, 226, 196;
  --orb-clay: 190, 98, 80;
  --orb-slate: 70, 116, 134;
}

/* The page ground lives on <html>; body must be clear so orbs show behind content */
body { background: transparent; }

/* The old single sand glows are replaced by the orbs */
.hero::before,
.page-hero::before,
.cta::before,
.flow-pic::before { display: none; }

.has-orb { position: relative; }
/* These sections used to clip all round; clip only sideways so glows fade softly up and down */
.cta.has-orb,
.page-hero.has-orb { overflow: visible; overflow-x: clip; }

.orb {
  position: absolute;
  z-index: -1;
  left: var(--x);
  top: var(--y);
  width: min(var(--s), 130vw);
  aspect-ratio: var(--ar, 1);
  margin: calc(min(var(--s), 130vw) / var(--ar, 1) / -2) 0 0 calc(min(var(--s), 130vw) / -2);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 48px, 0) scale(0.55);
  transition:
    opacity 1.1s cubic-bezier(0.4, 0, 0.2, 1),
    transform 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.orb.is-lit {
  opacity: 1;
  transform: none;
  transition:
    opacity 1.8s cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0s),
    transform 2.4s cubic-bezier(0.2, 0.9, 0.25, 1.06) var(--delay, 0s);
}

.orb i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--c), var(--a)) 0%, rgba(var(--c), calc(var(--a) * 0.7)) 26%, rgba(var(--c), calc(var(--a) * 0.28)) 55%, rgba(var(--c), calc(var(--a) * 0.07)) 80%, rgba(var(--c), 0) 100%);
  -webkit-mask: url('../assets/grain-mask.png') repeat 0 0 / 160px 160px;
  mask: url('../assets/grain-mask.png') repeat 0 0 / 160px 160px;
  animation: orb-breathe var(--d, 60s) ease-in-out infinite alternate;
  animation-delay: var(--dl, 0s);
  animation-play-state: paused;
}
.orb.is-lit i { animation-play-state: running; }

/* Barely-there movement once lit, so the light feels alive, never busy */
@keyframes orb-breathe {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2.5%, 3%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, -1.5%, 0) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .orb.is-lit { opacity: 1; transform: none; transition: none; }
  .orb i { animation: none; }
}
