/* Animated "night drive" background — soft red glows + light trails in the brand colors.
   Replaces the old brand-logo collage. Add class="afg-live-bg" to a section and include
   scripts/live-bg.js; the script injects the .afg-live-layer below. */
.afg-live-bg {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.afg-live-layer {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* faint slanted hairlines, same lean as the logo's italic */
  background: repeating-linear-gradient(99deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 64px);
  /* fade in/out at the top and bottom so there's no seam against neighbouring sections */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 140px, #000 calc(100% - 140px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 140px, #000 calc(100% - 140px), transparent 100%);
}
/* edge vignette keeps the middle (where the content sits) calm */
.afg-live-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(10, 11, 11, 0.6) 100%);
}

.afg-glow {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent);
  animation: afg-drift var(--d) ease-in-out var(--delay) infinite alternate;
  will-change: transform;
}
@keyframes afg-drift {
  from { transform: translate3d(-8%, -6%, 0) scale(1); }
  to   { transform: translate3d(8%, 6%, 0) scale(1.18); }
}

/* Trails share one tilted track so they all travel along the same diagonal */
.afg-trails {
  position: absolute;
  inset: -30% -15%;
  transform: rotate(-12deg);
}
.afg-trail {
  position: absolute;
  left: 0;
  top: var(--y);
  width: 100%;
  height: var(--h);
  /* bright head at 50% with a fading tail behind it */
  background: linear-gradient(90deg, transparent calc(50% - var(--len)), var(--c) 50%, transparent 50%);
  opacity: 0;
  animation: afg-trail var(--d) linear var(--delay) infinite;
  will-change: transform, opacity;
}
@keyframes afg-trail {
  0%   { transform: translateX(-62%); opacity: 0; }
  12%  { opacity: var(--o); }
  82%  { opacity: var(--o); }
  100% { transform: translateX(62%); opacity: 0; }
}

/* Off-screen sections stop animating (set by live-bg.js) */
.afg-live-bg.afg-paused .afg-glow,
.afg-live-bg.afg-paused .afg-trail {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .afg-glow { animation: none; }
  .afg-trail { display: none; }
}
