/*
 * The loading screen: the "Quantum Cloud Loader" (four glowing particles on slow orbits that pass in front of and
 * behind each other), ported from the React component (quantum-cloud-loader.tsx) to plain CSS, because this site has
 * no React and no Tailwind. Sizes, colours, glows, z-order, keyframes and timings are the component's own.
 *
 * Design rules of the original, kept: no gradients, no abrupt direction changes, long smooth curves, depth through
 * scale and opacity, and different orbit speeds (3.1s, 3.8s, 5.6s, 6.4s) so the pattern never visibly repeats.
 *
 * It is a full-screen cover (#boot) that js/boot.js shows while the site starts and then fades out. It is only
 * shown when JavaScript is running (html.booting), so a visitor without JavaScript never gets stuck behind it.
 */

#boot {
  position: fixed; inset: 0; z-index: 1000;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg, #fff); /* the page colour, white or the warm near-black in dark mode */
  opacity: 1;
  /* The site's --ease-out. The cover dissolves while the page behind it eases in (js/motion.js), so the two cross-fade;
     the particles drift outward and fade a little sooner than the cover itself. */
  transition: opacity 480ms cubic-bezier(0.23, 1, 0.32, 1);
}
html.booting #boot { display: flex; }
#boot.leaving { opacity: 0; pointer-events: none; }
#boot .qc-loader { transition: opacity 320ms cubic-bezier(0.23, 1, 0.32, 1), transform 480ms cubic-bezier(0.23, 1, 0.32, 1); }
#boot.leaving .qc-loader { opacity: 0; transform: scale(1.18); }
@media (prefers-reduced-motion: reduce) { #boot.leaving .qc-loader { transform: none; } }

.boot-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.boot-slow { margin: 0; padding: 0 16px; max-width: 28rem; text-align: center; font: 500 14px/1.5 system-ui, sans-serif; color: var(--muted, #675e55); }
.boot-slow[hidden] { display: none; }
.boot-slow a { color: var(--accent-text, #c23a10); }

/* ---- the loader itself (flex min-h-[200px] items-center justify-center overflow-hidden) ---- */

.qc-loader { display: flex; width: 100%; max-width: 36rem; min-height: 200px; align-items: center; justify-content: center; overflow: hidden; padding: 0 16px; }

/* relative isolate flex h-24 w-44 items-center justify-center */
.qc-stage { position: relative; isolation: isolate; display: flex; width: 11rem; height: 6rem; align-items: center; justify-content: center; }

.qc-dot { position: absolute; will-change: transform, opacity; }
.qc-dot > span { display: block; width: 100%; height: 100%; border-radius: 9999px; }

/* RED: fast inner particle (h-4 w-4, z-30) */
.qc-red { z-index: 30; width: 1rem; height: 1rem; animation: quantum-red 3.8s cubic-bezier(0.37, 0, 0.63, 1) infinite; }
.qc-red > span { background: #f87171; box-shadow: 0 0 12px rgba(248, 113, 113, 0.75), 0 0 24px rgba(248, 113, 113, 0.3); }

/* BLUE: large outer particle (h-6 w-6, z-10) */
.qc-blue { z-index: 10; width: 1.5rem; height: 1.5rem; animation: quantum-blue 5.6s cubic-bezier(0.37, 0, 0.63, 1) infinite; }
.qc-blue > span { background: #60a5fa; box-shadow: 0 0 16px rgba(96, 165, 250, 0.7), 0 0 30px rgba(96, 165, 250, 0.25); }

/* YELLOW: centre particle (h-5 w-5, z-40) */
.qc-yellow { z-index: 40; width: 1.25rem; height: 1.25rem; animation: quantum-yellow 3.1s cubic-bezier(0.37, 0, 0.63, 1) infinite; }
.qc-yellow > span { background: #facc15; box-shadow: 0 0 14px rgba(250, 204, 21, 0.75), 0 0 26px rgba(250, 204, 21, 0.3); }

/* GREEN: slow orbital particle (h-3.5 w-3.5, z-0) */
.qc-green { z-index: 0; width: 0.875rem; height: 0.875rem; animation: quantum-green 6.4s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate; }
.qc-green > span { background: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.75), 0 0 24px rgba(74, 222, 128, 0.3); }

/* RED: fast but smooth horizontal orbit */
@keyframes quantum-red {
  0%   { transform: translate3d(-46px, 7px, 0) scale(0.72); opacity: 0.45; }
  25%  { transform: translate3d(-23px, -7px, 0) scale(0.95); opacity: 0.78; }
  50%  { transform: translate3d(46px, 0, 0) scale(1.18); opacity: 1; }
  75%  { transform: translate3d(23px, 7px, 0) scale(0.95); opacity: 0.78; }
  100% { transform: translate3d(-46px, 7px, 0) scale(0.72); opacity: 0.45; }
}

/* BLUE: slow, heavy orbital movement */
@keyframes quantum-blue {
  0%   { transform: translate3d(38px, -4px, 0) scale(1); opacity: 0.95; }
  25%  { transform: translate3d(19px, 7px, 0) scale(0.88); opacity: 0.72; }
  50%  { transform: translate3d(-38px, 3px, 0) scale(0.68); opacity: 0.42; }
  75%  { transform: translate3d(-19px, -7px, 0) scale(0.88); opacity: 0.72; }
  100% { transform: translate3d(38px, -4px, 0) scale(1); opacity: 0.95; }
}

/* YELLOW: smooth central oscillator */
@keyframes quantum-yellow {
  0%   { transform: translate3d(-27px, 2px, 0) scale(0.82); opacity: 0.65; }
  20%  { transform: translate3d(-17px, -5px, 0) scale(0.94); opacity: 0.82; }
  50%  { transform: translate3d(27px, 0, 0) scale(1.08); opacity: 1; }
  80%  { transform: translate3d(17px, 5px, 0) scale(0.94); opacity: 0.82; }
  100% { transform: translate3d(-27px, 2px, 0) scale(0.82); opacity: 0.65; }
}

/* GREEN: slow wide orbital sweep */
@keyframes quantum-green {
  0%   { transform: translate3d(64px, 6px, 0) scale(0.52); opacity: 0.25; }
  20%  { transform: translate3d(43px, -5px, 0) scale(0.68); opacity: 0.45; }
  50%  { transform: translate3d(0, 3px, 0) scale(1); opacity: 0.9; }
  80%  { transform: translate3d(-43px, -5px, 0) scale(0.68); opacity: 0.45; }
  100% { transform: translate3d(-64px, 6px, 0) scale(0.52); opacity: 0.25; }
}

/* Accessibility. The component stops the animation; each particle then rests at its first keyframe, so the four
   stay apart instead of stacking into one blob in the middle. */
@media (prefers-reduced-motion: reduce) {
  .qc-dot { animation: none; will-change: auto; }
  .qc-red { transform: translate3d(-46px, 7px, 0) scale(0.72); opacity: 0.45; }
  .qc-blue { transform: translate3d(38px, -4px, 0) scale(1); opacity: 0.95; }
  .qc-yellow { transform: translate3d(-27px, 2px, 0) scale(0.82); opacity: 0.65; }
  .qc-green { transform: translate3d(64px, 6px, 0) scale(0.52); opacity: 0.25; }
}
