/* Hero background: "Orbit" (v7) + agent cards (v8), built by js/hero.js. Compositor-only:
   keyframes animate transform and opacity, nothing else. No canvas, no filter, no per-frame JS.
   Gold comes from --fx (the logo gold as an RGB triplet) so the alpha can change per theme. */

.fx {
  --fx: 176 158 128;
  --fa: 1;            /* alpha multiplier: light mode needs more to read on cream */
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.fx.is-ready { opacity: 1; }
[data-theme="light"] .fx { --fa: 1.5; }
.hero--page .fx { --q: 0.85; }

/* Pause when off-screen or the tab is hidden (js/hero.js toggles .is-paused). */
.fx.is-paused,
.fx.is-paused * { animation-play-state: paused !important; }

/* ── Orbit ─────────────────────────────────────────────────────────────── */
.o1 { position: absolute; inset: 0; display: grid; place-items: center; }
.o1__sys {
  position: relative;
  /* --sw is set by js/hero.js so the outer ring and its lights always fit inside the hero */
  width: var(--sw, min(88vw, 1480px));
  height: calc(var(--sw, min(88vw, 1480px)) * var(--ratio, 0.34));
  transform: rotate(-8deg);
  animation: o1tilt 36s cubic-bezier(.37,0,.63,1) -12s infinite alternate;
}
@keyframes o1tilt { from { transform: rotate(-10deg); } to { transform: rotate(-4deg); } }

.o1__core {
  position: absolute;
  inset: 18% 30%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(var(--fx) / calc(0.16 * var(--fa))), transparent);
}
.o1__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--k) * 100%);
  height: calc(var(--k) * 100%);
  transform: translate(-50%, -50%);
}
.o1__line {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* v10: stronger, still thin. 1px up to ~1700 wide, 1.5px on big screens so it holds at 2560. */
  border: var(--lw, 1px) solid rgb(var(--fx) / calc(0.3 * var(--fa) * var(--q, 1)));
  border-top-color: rgb(var(--fx) / calc(0.15 * var(--fa) * var(--q, 1)));
  border-bottom-color: rgb(var(--fx) / calc(0.66 * var(--fa) * var(--q, 1)));
}
@media (min-width: 1800px) { .fx { --lw: 1.5px; } }
/* Page-coloured veil over the rings, behind the copy: keeps the headline clear of the lines.
   Not a light: it is the page colour fading to transparent (part of the orbit art). */
.o1__veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 34% 30% at 50% 52%, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 55%, transparent 100%);
}
/* x and y sweeps, a quarter period apart, trace the ellipse; the dot grows at the front. */
.o1__x {
  --ease: cubic-bezier(.37,0,.63,1);
  --dy: calc(var(--d) - var(--T) / 4);
  position: absolute;
  inset: 0;
  animation: o1x calc(var(--T) / 2) var(--ease) var(--d) infinite alternate;
}
.o1__y {
  position: absolute;
  inset: 0;
  animation: o1y calc(var(--T) / 2) var(--ease) var(--dy) infinite alternate;
}
.o1__y i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgb(var(--fx));
  box-shadow: 0 0 0 4px rgb(var(--fx) / 0.2), 0 0 18px 4px rgb(var(--fx) / 0.5);
  animation: o1z calc(var(--T) / 2) var(--ease) var(--dy) infinite alternate;
}
[data-theme="light"] .o1__y i { box-shadow: 0 0 0 4px rgb(var(--fx) / 0.3), 0 0 16px 3px rgb(var(--fx) / 0.55); }
@media (min-width: 1800px) { .o1__y i { width: 10px; height: 10px; margin: -5px 0 0 -5px; } }
@keyframes o1x { from { transform: translateX(-50%); } to { transform: translateX(50%); } }
@keyframes o1y { from { transform: translateY(-50%); } to { transform: translateY(50%); } }
/* Back of the orbit: smaller and dimmer, never gone (min opacity 0.65). */
@keyframes o1z { from { transform: scale(0.7); opacity: 0.65; } to { transform: scale(1.15); opacity: 1; } }


/* ── Agent cards (v8, home hero) ─────────────────────────────────────────
   Small near-square glass cards placed around the orbit by js/hero.js. Each .ag group
   translates with its ring point (keyframes agd0-3 are written by hero.js with the orbit's
   own duration, delay and easing), so card, line and ring point move together. No backdrop
   blur (it would re-blur every frame over the moving lights); the glass is a translucent fill
   plus a 1px edge. Only transform and opacity animate. */
.ags {
  /* v10: stronger glass: clearer edge, brighter top highlight, a faint sheen and a soft halo */
  --ag-bg: rgb(29 45 66 / 0.72);
  --ag-sheen: rgb(255 255 255 / 0.05);
  --ag-edge: rgb(255 255 255 / 0.2);
  --ag-hi: rgb(255 255 255 / 0.14);
  --ag-halo: 0 10px 28px -12px rgb(5 10 20 / 0.7), 0 0 24px -8px rgb(176 158 128 / 0.3);
  --ag-wire: rgb(176 158 128 / 0.5);
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  /* v9: .ags opacity is the scroll fade, set per frame by js/hero.js (no transition, so it tracks
     the scroll exactly). The one-time fade-in on load lives on each .ag instead. */
  will-change: opacity;
}
.ags .ag { opacity: 0; transition: opacity 1.4s ease 0.3s; }
.ags.is-ready .ag { opacity: 1; }
/* fully faded out (scrolled past ~60% of the hero): skip painting, pause the inner loops.
   The drift on .ag itself keeps running so cards stay on the orbit's clock. */
.ags.is-gone { visibility: hidden; }
.ags.is-gone .ag *,
.ags.is-gone .ag *::before,
.ags.is-gone .ag *::after { animation-play-state: paused !important; }
[data-theme="light"] .ags {
  --ag-bg: rgb(255 253 250 / 0.8);
  --ag-sheen: rgb(255 255 255 / 0.6);
  --ag-edge: rgb(25 37 55 / 0.18);
  --ag-hi: rgb(255 255 255 / 1);
  --ag-halo: 0 10px 26px -14px rgb(25 37 55 / 0.28), 0 0 24px -8px rgb(176 158 128 / 0.45);
  --ag-wire: rgb(176 158 128 / 0.85);
}
.ag {
  position: absolute;
  left: 0;
  top: 0;
  animation: none 36s cubic-bezier(.37,0,.63,1) -12s infinite alternate;  /* = o1tilt */
}
.ag.is-off { visibility: hidden; }
/* hidden cards (phones show 2): stop their inner loops; only the invisible drift keeps the orbit's clock */
.ag.is-off *, .ag.is-off *::before, .ag.is-off *::after { animation: none !important; }
.ag__card {
  position: relative;
  width: 184px;
  padding: 12px 12px 13px;
  border: 1px solid var(--ag-edge);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--ag-sheen), transparent 50%), var(--ag-bg);
  box-shadow: 0 1px 0 var(--ag-hi) inset, var(--ag-halo);
  color: var(--ink);
}
.ag__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ag__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--ag-edge) inset;
  color: var(--gold-ink);
}
.ag__icon svg { width: 15px; height: 15px; }
.ag__dot { position: relative; width: 7px; height: 7px; margin-right: 2px; border-radius: 50%; background: var(--gold); }
.ag__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--gold);
  animation: agping 2.6s ease-out infinite;
}
@keyframes agping { from { transform: scale(1); opacity: 0.8; } 70%, to { transform: scale(2.6); opacity: 0; } }
.ag--needs .ag__dot { background: transparent; box-shadow: 0 0 0 1.5px var(--gold) inset; }
.ag--needs .ag__dot::after { animation: none; opacity: 0; }
.ag__name { font-size: 0.84375rem; font-weight: 500; line-height: 1.3; letter-spacing: -0.005em; }
.ag__s { display: grid; margin-top: 3px; color: var(--muted); font-size: 0.78125rem; line-height: 1.35; }
.ag__s > span { grid-area: 1 / 1; }
/* Status lines crossfade in one grid cell (cell = the longest line): no layout shift. */
.ag__s--3 > span { animation: agc3 13.5s linear infinite; }
.ag__s--3 > span:nth-child(2) { animation-delay: -9s; }
.ag__s--3 > span:nth-child(3) { animation-delay: -4.5s; }
.ag__s--2 > span { animation: agc2 11s linear infinite; }
.ag__s--2 > span:nth-child(2) { animation-delay: -5.5s; }
.ag[data-slot="tr"] .ag__s--3 > span { animation-delay: -2.2s; }
.ag[data-slot="tr"] .ag__s--3 > span:nth-child(2) { animation-delay: -11.2s; }
.ag[data-slot="tr"] .ag__s--3 > span:nth-child(3) { animation-delay: -6.7s; }
@keyframes agc3 { 0%, 30% { opacity: 1; } 33.34%, 96.66% { opacity: 0; } 100% { opacity: 1; } }
@keyframes agc2 { 0%, 46% { opacity: 1; } 50%, 96% { opacity: 0; } 100% { opacity: 1; } }
.ag__btn {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-top: 10px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-navy);
  font-size: 0.75rem;
  font-weight: 500;
}
/* Line from the card edge to its ring point, with a light running card → ring. */
.ag__wire {
  position: absolute;
  height: 1px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--ag-wire), rgb(176 158 128 / 0.18));
}
.ag__wire[hidden], .ag__node[hidden] { display: none; }
.ag__run { position: absolute; left: 0; top: -2px; width: 100%; height: 5px; animation: agrun 5.2s cubic-bezier(.45,0,.55,1) infinite; }
.ag__run::before { content: ""; position: absolute; left: -2.5px; top: 0; width: 5px; height: 5px; border-radius: 50%; background: rgb(var(--fxc, 176 158 128)); }
.ag[data-slot="tr"] .ag__run { animation-delay: -1.3s; }
.ag[data-slot="bl"] .ag__run { animation-delay: -2.6s; }
.ag[data-slot="br"] .ag__run { animation-delay: -3.9s; }
@keyframes agrun { 0% { transform: translateX(0); opacity: 0; } 10% { opacity: 1; } 62% { transform: translateX(100%); opacity: 1; } 72%, 100% { transform: translateX(100%); opacity: 0; } }
.ag__node {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 1.5px var(--gold) inset;
}
.ags.is-paused,
.ags.is-paused *,
.ags.is-paused *::before,
.ags.is-paused *::after { animation-play-state: paused !important; }
@media (min-width: 1800px) {
  .ag__card { width: 212px; padding: 14px 14px 15px; }
  .ag__name { font-size: 0.9375rem; }
  .ag__s { font-size: 0.84375rem; }
  .ag__icon { width: 30px; height: 30px; }
}
@media (max-width: 639px) {
  .ag__card { width: 168px; padding: 10px 10px 11px; }
  .ag__top { margin-bottom: 10px; }
}

/* ── Reduced motion: hold a still frame (each light frozen at its own phase) ── */
@media (prefers-reduced-motion: reduce) {
  .fx { transition: none; }
  .fx .o1__sys { animation: o1tilt 36s linear -12s infinite alternate paused !important; }
  .fx .o1__x { animation: o1x calc(var(--T) / 2) var(--ease) var(--d) infinite alternate paused !important; }
  .fx .o1__y { animation: o1y calc(var(--T) / 2) var(--ease) var(--dy) infinite alternate paused !important; }
  .fx .o1__y i { animation: o1z calc(var(--T) / 2) var(--ease) var(--dy) infinite alternate paused !important; }
  /* cards: frozen at the same phase as the (linear, paused) tilt, one status line each */
  .ags .ag { transition: none; }
  .ags .ag { animation-duration: 36s !important; animation-iteration-count: infinite !important; animation-timing-function: linear !important; animation-play-state: paused !important; }
  .ags .ag__s--3 > span { animation-duration: 13.5s !important; animation-iteration-count: infinite !important; animation-play-state: paused !important; }
  .ags .ag__s--2 > span { animation-duration: 11s !important; animation-iteration-count: infinite !important; animation-play-state: paused !important; }
  .ags .ag__run, .ags .ag__dot::after { display: none; }
}
