/* =====================================================================
   Aurora Veil: homepage ambient background (Ultra-Premium brief v1.0)
   A fixed, inert layer behind all content: navy base wash, four
   pre-blurred aurora orbs, three soft gradient ribbons, one light sweep,
   film grain and a vignette. CSS only; animates transform and opacity
   only. Blur is baked into the gradient stops (no filter, no backdrop).
   ===================================================================== */

.aurora-veil {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  contain: strict;
  /* Layer 0: base wash, never a solid fill */
  background: linear-gradient(180deg, #05070E 0%, #0A0F1E 55%, #070B16 100%);
  --av-o: 1;        /* opacity scale per breakpoint */
  --av-speed: 1;    /* duration multiplier per breakpoint */
}
/* The homepage's base colour is the veil's navy, so the hero reads dark even before the veil paints. */
.page-home { background-color: #070B16; }
/* Content sits above the veil (z >= 1). The header already has z 50. */
.page-home main, .page-home .site-footer { position: relative; z-index: 1; }
/* Sections that relied on the light page background keep it (zero specificity, so any
   section with its own background still wins). Only the hero lets the veil show through;
   its canvas, scrim and content are unchanged. */
:where(.page-home main > *) { background-color: var(--bg, #F7F9FC); }
.page-home .hero-ai { background: transparent; }

.aurora-veil .av-fx { position: absolute; inset: 0; opacity: var(--av-o); }

/* Layer 1: aurora orbs, pre-blurred radial falloff */
.av-orb {
  position: absolute; border-radius: 50%; will-change: transform;
  animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate;
  animation-duration: calc(var(--d) * var(--av-speed));
}
.av-orb-azure  { --d: 52s; width: 58vw; height: 58vw; left: -16vw; top: -22vw; animation-name: av-path-a; animation-delay: 0s;
  background: radial-gradient(closest-side, rgba(91,140,255,.16) 0%, rgba(91,140,255,.10) 32%, rgba(91,140,255,.04) 62%, rgba(91,140,255,0) 100%); }
.av-orb-violet { --d: 60s; width: 50vw; height: 50vw; left: 48vw; top: -6vw;  animation-name: av-path-b; animation-delay: -12s;
  background: radial-gradient(closest-side, rgba(139,92,246,.14) 0%, rgba(139,92,246,.085) 32%, rgba(139,92,246,.03) 62%, rgba(139,92,246,0) 100%); }
.av-orb-teal   { --d: 44s; width: 56vw; height: 56vw; left: 14vw; top: 46vh;  animation-name: av-path-c; animation-delay: -24s;
  background: radial-gradient(closest-side, rgba(45,212,191,.12) 0%, rgba(45,212,191,.07) 32%, rgba(45,212,191,.025) 62%, rgba(45,212,191,0) 100%); }
.av-orb-amber  { --d: 56s; width: 40vw; height: 40vw; left: 70vw; top: 58vh;  animation-name: av-path-d; animation-delay: -36s;
  background: radial-gradient(closest-side, rgba(245,158,11,.07) 0%, rgba(245,158,11,.04) 32%, rgba(245,158,11,.015) 62%, rgba(245,158,11,0) 100%); }

/* Slow, overlapping Lissajous-style paths, each a different shape */
@keyframes av-path-a { 0% { transform: translate3d(0,0,0); } 25% { transform: translate3d(5vw,2vh,0); } 50% { transform: translate3d(7vw,7vh,0); } 75% { transform: translate3d(2vw,9vh,0); } 100% { transform: translate3d(-3vw,5vh,0); } }
@keyframes av-path-b { 0% { transform: translate3d(0,0,0); } 25% { transform: translate3d(-4vw,5vh,0); } 50% { transform: translate3d(-8vw,2vh,0); } 75% { transform: translate3d(-5vw,-3vh,0); } 100% { transform: translate3d(2vw,4vh,0); } }
@keyframes av-path-c { 0% { transform: translate3d(0,0,0); } 25% { transform: translate3d(6vw,-3vh,0); } 50% { transform: translate3d(10vw,-6vh,0); } 75% { transform: translate3d(5vw,-9vh,0); } 100% { transform: translate3d(-2vw,-5vh,0); } }
@keyframes av-path-d { 0% { transform: translate3d(0,0,0); } 33% { transform: translate3d(-5vw,-4vh,0); } 66% { transform: translate3d(-9vw,2vh,0); } 100% { transform: translate3d(-3vw,6vh,0); } }

/* Layer 2: gradient ribbons (blue -> violet -> teal), soft edges from a static mask */
.av-wave {
  position: absolute; left: -40vw; width: 180vw; height: 30vh; will-change: transform;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 0%, rgba(0,0,0,.55) 45%, transparent 75%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 0%, rgba(0,0,0,.55) 45%, transparent 75%);
  animation: av-ribbon calc(var(--d) * var(--av-speed)) ease-in-out infinite alternate;
}
.av-wave-1 { --d: 34s; top: 6vh;  transform: rotate(-6deg);
  background: linear-gradient(90deg, rgba(91,140,255,0) 0%, rgba(91,140,255,.10) 25%, rgba(139,92,246,.09) 50%, rgba(45,212,191,.08) 75%, rgba(45,212,191,0) 100%); }
.av-wave-2 { --d: 40s; top: 44vh; animation-delay: -14s;
  background: linear-gradient(90deg, rgba(139,92,246,0) 0%, rgba(139,92,246,.08) 30%, rgba(91,140,255,.09) 55%, rgba(45,212,191,.07) 80%, rgba(45,212,191,0) 100%); }
.av-wave-3 { --d: 26s; top: 74vh; animation-delay: -6s;
  background: linear-gradient(90deg, rgba(45,212,191,0) 0%, rgba(45,212,191,.08) 30%, rgba(91,140,255,.07) 60%, rgba(139,92,246,.06) 85%, rgba(139,92,246,0) 100%); }
@keyframes av-ribbon {
  0%   { transform: translate3d(-6vw, 0, 0) rotate(-4deg); }
  50%  { transform: translate3d(2vw, -3vh, 0) rotate(-2deg); }
  100% { transform: translate3d(7vw, 2vh, 0) rotate(-5deg); }
}

/* Layer 3: one faint diagonal light sweep, off-screen most of the time */
.av-sweep {
  position: absolute; top: -40vh; left: 0; width: 22vw; height: 180vh; will-change: transform;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(214,226,255,.045) 50%, rgba(255,255,255,0) 100%);
  transform: translate3d(-60vw, 0, 0) rotate(18deg);
  animation: av-sweep calc(38s * var(--av-speed)) ease-in-out infinite alternate;
}
@keyframes av-sweep {
  0%, 30%   { transform: translate3d(-60vw, 0, 0) rotate(18deg); }
  70%, 100% { transform: translate3d(140vw, 0, 0) rotate(18deg); }
}

/* Layer 4: film grain (prevents banding on OLED / large panels) + vignette. Static. */
.av-grain {
  position: absolute; inset: 0; opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
.av-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 75% 70% at 50% 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,.14) 100%); }

/* Pause: hidden tab, the hero's "Pause background animation" button, slow mobile devices */
.aurora-veil.av-paused *,
.page-home:has(.hero-ai .motion-toggle[aria-pressed="true"]) .aurora-veil * { animation-play-state: paused; }

/* Reduced motion: one composed static frame, frozen mid-drift (negative delays hold each layer mid-path) */
@media (prefers-reduced-motion: reduce) { .aurora-veil * { animation-play-state: paused !important; } }

/* 768-1279: 3 orbs, 2 ribbons, no sweep, opacity x0.85 */
@media (max-width: 1279px) {
  .aurora-veil { --av-o: .85; }
  .av-orb-amber, .av-wave-3, .av-sweep { display: none; }
}
/* <= 767: 2 orbs, 1 ribbon, opacity x0.65, everything 20% slower */
@media (max-width: 767px) {
  .aurora-veil { --av-o: .65; --av-speed: 1.2; }
  .av-orb-violet, .av-wave-2 { display: none; }
  .av-orb-azure { width: 110vw; height: 110vw; left: -40vw; top: -30vw; }
  .av-orb-teal  { width: 110vw; height: 110vw; left: -10vw; top: 55vh; }
  .av-wave-1 { height: 24vh; }
}
