/* BY47 V18 particles (ferrofluid): the canvas, the still fallback, letters that fly in, panels that fade. Contract: V18-notes/engine/ENGINE.md.
   Colours of the board are read from these tokens once at start (override them on :root before particles.js runs). */
:root {
  --pe-paper: #ECECEC;          /* the light board: neutral grey-white */
  --pe-ink: #111111;
  --pe-graphite: #5C5C5C;
  --pe-dark: #0A0A0A;           /* the dark stage */
  --pe-dark-ink: #E8E8E8;
  --pe-dark-graphite: #808080;
  --pe-red: #D9202C;            /* the signal only */
}
/* the engine's canvas: fixed behind everything, never takes a click */
.pe-cv { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; display: block; pointer-events: none; opacity: 0; }
/* V22: shown only once its first frame is on screen (an opaque WebGL canvas is black until then: the phone's black blink) */
html.pe-on .pe-cv { opacity: 1; }
/* once the engine has drawn its first frame the scenes let the board show through */
html.pe-on [data-scene] { background-color: transparent; }

/* letters (data-pe-split): --pe-o 0 scattered .. 1 in place, set by particles.js */
.pe-w { display: inline-block; white-space: nowrap; }
.pe-ch { display: inline-block;
  transform: translate3d(calc(var(--dx, 0px) * (1 - var(--pe-o, 1))), calc(var(--dy, 0px) * (1 - var(--pe-o, 1))), 0) rotate(calc(var(--dr, 0deg) * (1 - var(--pe-o, 1))));
  opacity: clamp(0, calc(var(--pe-o, 1) * 3 - .2), 1); }
.pe-anim .pe-ch { will-change: transform, opacity; }
/* scattered letters must never widen the page (a phone would zoom out): clip sideways, keep sticky working */
html.pe-split { overflow-x: hidden; }   /* the root only: hidden on body would make it a scroller and break sticky */
@supports (overflow: clip) { html.pe-split, html.pe-split body, [data-scene] { overflow-x: clip; } }
/* panels (data-pe-panel) fade with their scene; a faded panel does not catch clicks */
[data-pe-panel] { opacity: var(--pe-o, 1); transform: translateY(calc((1 - var(--pe-o, 1)) * 18px)); }
[data-pe-panel][data-pe-off] { pointer-events: none; }
/* HUD numbers keep their width */
[data-pe-hud] { font-variant-numeric: tabular-nums; }
/* a finger holds the magnet (0.5 s on the form): no text selection or callout while it is held */
html.pe-holding, html.pe-holding body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* before the engine and without it, the page itself follows the scene's theme (particles.js sets html[data-pe-theme]) */
html[data-pe-theme="dark"] body { background-color: var(--pe-dark); }

/* the still picture: no WebGL2 / too slow / ?pe-off=1 */
.pe-backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-color: var(--pe-paper); transition: background-color .4s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='45.03'%3E%3Cpath d='M0 7.5L4.33 0h8.67L17.33 7.5 13 15H4.33zM13 15l4.33 7.5h8.67M17.33 7.5H26M13 30l4.33-7.5M4.33 15L0 22.5l4.33 7.5H13l4.33 7.5L13 45.03H4.33L0 37.5' fill='none' stroke='%23888' stroke-opacity='.22' stroke-width='.6'/%3E%3C/svg%3E");
  background-size: 26px 45.03px; }
.pe-still { position: absolute; display: block; object-fit: contain; opacity: 0; transition: opacity .5s; pointer-events: none; }
.pe-still--flow { z-index: -1; }
.pe-still--on, .pe-still--flow { opacity: 1; }
html[data-pe-theme="dark"] .pe-backdrop { background-color: var(--pe-dark); }
@media (prefers-reduced-motion: reduce) {
  .pe-ch, [data-pe-panel] { transform: none !important; }
  .pe-still { transition: none; }
}
