/* APX marketing site — animation & effect layer.
   All motion is gated: .is-in is added by js/site.js via IntersectionObserver,
   and prefers-reduced-motion renders everything in its final state. */

/* ── Ambient telemetry background (js/lab-bg.js) ──
   Fixed force-time waveform behind all content. Sits above the body's grid
   background but below in-flow content; transparent, so the grid shows through
   and it never intercepts pointer events. Empty (JS off) = grid only. */
#lab-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  display: block;
}

/* ── Scroll reveal (entry-only: js adds .is-in once and never removes it) ──
   Hidden initial states are gated behind scripting support: with JS disabled
   (or in browsers without the media feature) content renders fully visible. */
@media (scripting: enabled) {
  .reveal { opacity: 0; transform: translateY(18px); }
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 700ms ease var(--d, 0ms), transform 700ms cubic-bezier(.2, .8, .2, 1) var(--d, 0ms);
}

/* ── Scanline sweep on entry (add .scan alongside .reveal on a section wrapper) ── */
.scan { position: relative; overflow: clip; }
.scan::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--red), transparent) top / 100% 1px no-repeat;
  opacity: 0;
  pointer-events: none;
}
.scan.is-in::after { animation: scan-sweep 900ms ease-out 1 both; }
@keyframes scan-sweep {
  from { transform: translateY(0); opacity: .9; }
  to { transform: translateY(100%); opacity: 0; }
}

/* ── Metric ticker (hero) ── */
.ticker {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: .6rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker__track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: ticker-scroll 45s linear infinite;
}
.ticker__list {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.ticker__list .tick { color: var(--red); }
@keyframes ticker-scroll {
  to { transform: translateX(calc(-50% - 1.25rem)); } /* half the track + half the gap */
}

/* ── Self-drawing force trace (SVG with pathLength="1") ── */
.trace__path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
}
@media (scripting: enabled) {
  .trace__path { stroke-dasharray: 1; stroke-dashoffset: 1; }
}
.trace.is-in .trace__path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2200ms cubic-bezier(.4, 0, .2, 1) 200ms;
}
.trace__baseline { stroke: var(--line); stroke-dasharray: 4 6; }
.trace__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  fill: var(--muted);
}

/* ── Reduced motion: final states, no animation ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scan::after { display: none; }
  .ticker__track { animation: none; }
  .trace__path { stroke-dashoffset: 0; transition: none; }
  .email-form, .email-confirm, .btn, .card { transition: none; }
}
