/* =============================================================
   RECOVERED HOURS — motion.css  (v1)
   High-end parallax & depth layer for the Operations Hub theme.
   Progressive enhancement: nothing here is required for content.
   All motion is transform/opacity only and fully disabled under
   prefers-reduced-motion. Pairs with js/motion.js.
   ============================================================= */

/* ---------- Scroll progress bar ---------- */
.mo-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  z-index: 200;
  pointer-events: none;
  background: transparent;
}
.mo-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--hub-accent), var(--hub-team));
  transform-origin: 0 50%;
  transform: scaleX(var(--mo-progress, 0));
}

/* ---------- Nav condense on scroll ---------- */
.hub-nav, .rh-nav {
  transition: box-shadow 400ms var(--hub-ease), background 400ms var(--hub-ease);
}
html.mo-scrolled .hub-nav,
html.mo-scrolled .rh-nav {
  background: rgba(247, 249, 251, 0.92);
  box-shadow: 0 1px 0 rgba(26,43,60,.06), 0 12px 32px rgba(26,43,60,.08);
}

/* ---------- Ambient depth field (injected by motion.js) ----------
   Three softly-blurred orbs per host, each on its own parallax
   depth. Hosts: .hub-hero, .hub-pagehero, .hub-final__card.      */
.mo-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.mo-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
  opacity: .8;
}
.mo-orb--a { width: 44vw; height: 44vw; max-width: 560px; max-height: 560px; top: -18%; right: -8%;
  background: radial-gradient(circle at 35% 35%, rgba(37,99,235,.14), rgba(37,99,235,0) 68%); }
.mo-orb--b { width: 34vw; height: 34vw; max-width: 460px; max-height: 460px; bottom: -22%; left: -6%;
  background: radial-gradient(circle at 60% 40%, rgba(99,102,241,.12), rgba(99,102,241,0) 70%); }
.mo-orb--c { width: 22vw; height: 22vw; max-width: 300px; max-height: 300px; top: 32%; left: 38%;
  background: radial-gradient(circle at 50% 50%, rgba(245,166,35,.09), rgba(245,166,35,0) 70%); }

/* Faint drafting grid that drifts slower than the page (depth cue) */
.mo-grid {
  position: absolute;
  inset: -20% 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(26,43,60,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,43,60,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(80% 70% at 50% 30%, #000 0%, transparent 78%);
  mask-image: radial-gradient(80% 70% at 50% 30%, #000 0%, transparent 78%);
  will-change: transform;
}

/* Hosts must own their stacking context so content sits above the field */
.hub-hero, .hub-pagehero, .hub-final__card { position: relative; }
.hub-hero > .hub-container,
.hub-pagehero > .hub-container { position: relative; z-index: 1; }
.hub-final__card > * { position: relative; z-index: 1; }
.hub-final__card .mo-field { border-radius: inherit; }

/* ---------- Parallax primitives ----------
   js/motion.js drives --mo-y (px) and --mo-tx/--mo-ty (pointer)
   on any [data-plx] element via a single rAF loop with lerp.    */
[data-plx] { will-change: transform; }

/* ---------- Hero panel: 3D presence ---------- */
@media (hover: hover) and (pointer: fine) {
  .mo-tilt {
    transform-style: preserve-3d;
    transform: perspective(1100px)
               rotateX(var(--mo-rx, 0deg))
               rotateY(var(--mo-ry, 0deg))
               translateY(var(--mo-y, 0px));
    transition: box-shadow 500ms var(--hub-ease);
  }
  .mo-tilt.is-hover { box-shadow: var(--hub-shadow-lift), 0 30px 80px rgba(37,99,235,.10); }
}

/* ---------- Headline line reveal (upgrade of hub-reveal) ---------- */
.mo-lines .mo-line {
  display: block;
  overflow: hidden;
}
.mo-lines .mo-line > span {
  display: block;
  transform: translateY(110%);
  opacity: 0;
  transition:
    transform 900ms var(--hub-ease),
    opacity   600ms var(--hub-ease);
  transition-delay: calc(var(--mo-i, 0) * 110ms);
}
.mo-lines.is-visible .mo-line > span { transform: none; opacity: 1; }

/* ---------- Scroll-scrub: elements that ease with viewport position ----
   CSS scroll-driven animations where supported; motion.js provides the
   fallback by setting --mo-y on [data-plx].                              */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .mo-drift-slow, .mo-drift-fast {
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
      animation-timing-function: linear;
      animation-fill-mode: both;
    }
    .mo-drift-slow { animation-name: mo-drift-s; }
    .mo-drift-fast { animation-name: mo-drift-f; }
  }
}
@keyframes mo-drift-s { from { transform: translateY(34px); } to { transform: translateY(-34px); } }
@keyframes mo-drift-f { from { transform: translateY(64px); } to { transform: translateY(-64px); } }

/* ---------- Journey progress line ---------- */
.hub-journey { position: relative; }
.mo-journey-line {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--hub-accent), var(--hub-team));
  transform-origin: 0 50%;
  transform: scaleX(var(--mo-journey, 0));
  border-radius: 0 999px 999px 0;
  pointer-events: none;
}

/* ---------- Section ambience: tinted sections gain slow gradient drift -- */
.hub-section--tint { position: relative; overflow: hidden; }
.hub-section--tint > .hub-container { position: relative; z-index: 1; }

/* ---------- Ticker: pause on hover (courtesy) ---------- */
.hub-ticker:hover .hub-ticker__track { animation-play-state: paused; }

/* =============================================================
   V2 — AUTOMATION VISUAL LANGUAGE
   Particle work-stream, spotlight cards, magnetic CTAs,
   conveyor seams, live-feed choreography.
   ============================================================= */

/* ---------- Hero particle canvas (injected by motion.js) ---------- */
.mo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Accent shimmer on display headlines ---------- */
.hub-display .hub-accent,
.hub-pagehero__title .hub-accent,
.hub-pagehero__title > span[style] {
  background: linear-gradient(100deg,
    var(--hub-accent) 0%, var(--hub-team) 35%,
    var(--hub-accent-deep) 55%, var(--hub-accent) 75%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--hub-accent); /* fallback if clip unsupported */
  animation: mo-shimmer 7s var(--hub-ease) infinite;
}
@keyframes mo-shimmer {
  0%, 55%  { background-position: 0% 0; }
  85%, 100%{ background-position: -120% 0; }
}

/* ---------- Spotlight cards ----------
   motion.js sets --mx/--my (px, element-local) on hover.
   A soft accent halo follows the cursor along the border.  */
.mo-spot { position: relative; }
.mo-spot::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 450ms var(--hub-ease);
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
    rgba(37, 99, 235, 0.10), transparent 65%);
  z-index: 0;
}
.mo-spot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 450ms var(--hub-ease);
  padding: 1px;
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%),
    rgba(37, 99, 235, 0.55), rgba(99, 102, 241, 0.18) 45%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  z-index: 2;
}
.mo-spot.is-lit::before, .mo-spot.is-lit::after { opacity: 1; }
.mo-spot > * { position: relative; z-index: 1; }

/* ---------- Magnetic primary CTAs + shine sweep ---------- */
@media (hover: hover) and (pointer: fine) {
  .hub-btn--go, .hub-nav__cta {
    position: relative;
    overflow: hidden;
    transform: translate(var(--mo-bx, 0px), var(--mo-by, 0px));
  }
  /* keep magnet authority over hub.css hover lifts */
  .hub-btn--go:hover, .hub-nav__cta:hover {
    transform: translate(var(--mo-bx, 0px), calc(var(--mo-by, 0px) - 1px));
  }
  .hub-btn--go::after, .hub-nav__cta::after {
    content: "";
    position: absolute;
    top: 0; left: -80%;
    width: 60%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,.35), transparent);
    transform: skewX(-18deg);
    transition: none;
    pointer-events: none;
  }
  .hub-btn--go:hover::after, .hub-nav__cta:hover::after {
    animation: mo-shine 900ms var(--hub-ease);
  }
}
@keyframes mo-shine { to { left: 130%; } }

/* ---------- Live feed choreography (hub.js inserts items) ---------- */
.hub-feed__item {
  animation: mo-feed-in 650ms var(--hub-ease) backwards;
}
@keyframes mo-feed-in {
  0%   { opacity: 0; transform: translateY(-10px) scale(0.985); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.hub-feed__item:first-child .hub-feed__gain {
  animation: mo-gain-pop 700ms var(--hub-ease) 250ms backwards;
}
@keyframes mo-gain-pop {
  0%   { opacity: 0; transform: scale(.6); }
  70%  { transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
.hub-feed__item:first-child .hub-feed__icon {
  animation: mo-icon-ring 900ms var(--hub-ease) 150ms;
}
@keyframes mo-icon-ring {
  0%   { box-shadow: 0 0 0 0 rgba(99,102,241,.35); }
  100% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

/* ---------- Panel scan sweep — the AI at work ---------- */
.hub-pipe { position: relative; overflow: hidden; }
.hub-pipe::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 90px;
  left: -25%;
  background: linear-gradient(105deg, transparent,
    rgba(37,99,235,.06) 35%, rgba(99,102,241,.10) 50%,
    rgba(37,99,235,.06) 65%, transparent);
  animation: mo-scan 5.5s cubic-bezier(.45,0,.35,1) infinite;
  pointer-events: none;
}
@keyframes mo-scan {
  0%, 12%  { left: -25%; }
  55%, 100%{ left: 115%; }
}

/* ---------- Conveyor seams on tinted sections ---------- */
.hub-section--tint::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background-image: linear-gradient(90deg,
    var(--hub-accent-soft-2) 0 14px, transparent 14px 28px);
  background-size: 28px 2px;
  animation: mo-conveyor 2.6s linear infinite;
  opacity: .8;
  pointer-events: none;
}
@keyframes mo-conveyor { to { background-position: 28px 0; } }

/* ---------- Ticker: edge fades + belt feel ---------- */
.hub-ticker {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

/* ---------- Status dot: radar ping upgrade ---------- */
.hub-chip--live .hub-dot { position: relative; }
.hub-chip--live .hub-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--hub-accent);
  animation: mo-ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes mo-ping {
  0%   { transform: scale(.6); opacity: .9; }
  80%, 100% { transform: scale(2.1); opacity: 0; }
}

/* ---------- Reduced motion: kill everything ---------- */
@media (prefers-reduced-motion: reduce) {
  .mo-progress, .mo-field, .mo-grid, .mo-journey-line, .mo-canvas { display: none !important; }
  [data-plx], .mo-tilt { transform: none !important; }
  .mo-lines .mo-line > span { transform: none !important; opacity: 1 !important; transition: none !important; }
  .mo-drift-slow, .mo-drift-fast { animation: none !important; transform: none !important; }
  .hub-display .hub-accent,
  .hub-pagehero__title .hub-accent,
  .hub-pagehero__title > span[style] {
    animation: none !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--hub-accent) !important;
  }
  .mo-spot::before, .mo-spot::after { display: none !important; }
  .hub-btn--go, .hub-nav__cta { transform: none !important; }
  .hub-btn--go::after, .hub-nav__cta::after,
  .hub-pipe::after, .hub-section--tint::before,
  .hub-chip--live .hub-dot::after { display: none !important; animation: none !important; }
  .hub-feed__item, .hub-feed__gain, .hub-feed__icon { animation: none !important; }
}
