/* Ambient background (src/components/ambient.js): faint monospace rows of algorithm names drifting behind the
   panels. At most 5% opacity, page gutters only (panels are solid), transform-only motion on the compositor,
   static under reduced motion, hidden when printing. */

#ambient {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none; user-select: none;
  contain: strict;
  /* page headings and lead text sit on the paper at the top of the screen: keep that band clear of the rows */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 120px, #000 320px);
  mask-image: linear-gradient(to bottom, transparent 0, transparent 120px, #000 320px);
}
#app { position: relative; z-index: 1; }
/* a blurred, translucent topbar would re-blur the moving rows every frame: go near-solid while they are on */
.ambient-on .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(244, 246, 248, 0.97); }

.amb-layer {
  position: absolute; inset: 0;
  display: grid; align-content: space-around;
  font-family: var(--mono); color: var(--ink); white-space: nowrap;
  word-spacing: 2.4em; letter-spacing: 0.04em; line-height: 1;
  transition: color 1.2s var(--ease);
}
/* the overall posture tints the text; opacity (and so contrast) is unchanged */
body[data-posture="warn"] .amb-layer { color: var(--warn-fill); }
body[data-posture="crit"] .amb-layer { color: var(--crit-fill); }
body[data-posture="proc"] .amb-layer { color: var(--cobalt); }
body[data-posture="ok-soft"] .amb-layer { color: var(--ok-fill); }
.amb-d1 { font-size: 12px; opacity: 0.035; padding-top: 2vh; }
.amb-d2 { font-size: 13px; opacity: 0.045; padding-top: 8vh; }
.amb-d3 { font-size: 15px; opacity: 0.05; padding-top: 14vh; }

.amb-row { width: max-content; animation: amb-drift var(--amb-dur) linear infinite; }
.amb-d1 .amb-row { --amb-dur: 240s; }
.amb-d2 .amb-row { --amb-dur: 200s; }
.amb-d3 .amb-row { --amb-dur: 160s; }
.amb-row:nth-child(even) { animation-direction: reverse; }
.amb-row:nth-child(3n + 2) { animation-delay: -37s; }
.amb-row:nth-child(3n) { animation-delay: -81s; }
@keyframes amb-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .amb-row { animation: none; }
  #ambient { opacity: 0.7; }
}
@media print { #ambient { display: none; } }
