/* Classic app loader — ONE animated loader (lane FIX-1104-AO).

   Authority, verbatim: Jordan's words, 2026-11-04: "use the new loader with
   the hovering gif animated loader logo icon, then update any text if needed
   and make it just that 1, not 2." Plus "Jordan's ruling, 2026-11-04"
   (Design System artifact 7STmgQx6TGGyekrL4VCJYv, LoadingIndicators
   v1793816625-e9ad): ONE image only, with the WPSITEBEAM wordmark and one
   status line; no box or frame; Dark page-background token; status line
   role="status". Lane FIX-1105-AE, Jordan's words, 2026-11-05: "The loading
   icon is also the wrong one to use. look through our old claude design files
   to get the gif animated ones with the beam and design we created
   previously." The ONE image is now BeamAnim, the animated Set B logo mark
   (Design System MarkVariations, "Animated · on dark"): the saucer hovers and
   the tractor beam extends and retracts on a 7-second loop; under reduced
   motion the same mark is still (beam at rest). The sci-fi tractor loader
   (sf-tractor / ld-ufo-light / sf-beam-ring) is gone from this sheet.

   Used by every classic full-page loader: the index.html auth gate and
   auth/start.html. Both carry the SAME markup; test/classic-apploader-harness.mjs
   fails if they drift, if a second image appears, or if the old boxed lockup
   comes back.

   The mark is two layered <img> files (assets/brand/mark-ufo-saucer.svg and
   mark-tractor-beam.svg, byte copies of the Design System export's
   design/brand files and of v2/src/assets/concept/beam-ufo.svg / beam-ray.svg)
   styled with the Design System's `.ck-anim*` classes. The keyframes below are
   the bundle.css rules that are in effect (ck-float2 3s, ck-stretch 3s, ck-beam4
   7s), renamed wpsb-ldr-* and kept IN THIS SHEET so the animation cannot go
   missing when design CSS is absent. The loader sizes the mark by CSS, never
   an inline style attribute (the deployed CSP is style-src 'self').

   Colour: this sheet renders before (and independently of) design/tokens.css,
   and must show the Dark theme whatever theme the person chose — classic
   tokens switch on <html data-theme>, not on a wrapper. So the values are
   declared ONCE here as scoped custom properties on the loader:
     --ldr-bg / --ldr-beam / --ldr-muted = design/tokens.css :root (Dark)
       --bg / --beam / --muted.
   No other colour literal appears in this file. */

.wpsb-apploader {
  --ldr-bg: #060910;
  --ldr-beam: #00cfef;
  --ldr-muted: #9dbbd2;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0;
  padding: 0 16px;
  box-sizing: border-box;
  background: var(--ldr-bg);
  color: var(--ldr-beam);
  text-align: center;
}

/* The single image: BeamAnim, the animated Set B logo mark (440 x 360 art). */
.wpsb-apploader__loader {
  position: relative;
  display: block;
  flex: none;
  inline-size: 120px;
  aspect-ratio: 440 / 360;
}
.wpsb-apploader__loader img {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  display: block;
}

/* The wordmark (text image, not a mark). */
.wpsb-apploader__word {
  display: block;
  inline-size: 220px;
  max-inline-size: 70vw;
  block-size: auto;
}

/* One status line. */
.wpsb-apploader__status {
  margin: 0;
  min-block-size: 1.5em;
  max-inline-size: 36rem;
  color: var(--ldr-muted);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
  line-height: 1.5;
}

.wpsb-apploader .hidden,
.wpsb-apploader [hidden] { display: none !important; }

/* Only the saucer hovers; the beam stays grounded, stretches to follow it, and
   extends and retracts by clip-path on a 7-second loop. FIX-1111-LL ("Jordan's ruling, 2026-11-11") restored the 7s loop and its keyframes: the 3s retime (FIX-1105-AX) cut the beam going back up. */
.wpsb-apploader .ck-anim-float {
  position: absolute;
  inset: 0;
  z-index: 1;
  animation: wpsb-ldr-float 3s ease-in-out infinite;
  animation-delay: -2.59s;
}
.wpsb-apploader .ck-anim-stretch {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 50% 98%;
  animation: wpsb-ldr-stretch 3s ease-in-out infinite;
  animation-delay: -2.59s;
}
.wpsb-apploader .ck-anim-beam {
  clip-path: polygon(47.6% 32.8%, 52.4% 32.8%, 52.4% 32.8%, 51.68% 32.8%, 50% 32.8%, 48.32% 32.8%, 47.6% 32.8%);
  animation: wpsb-ldr-beam 7s linear infinite;
  animation-delay: -2.59s;
}

/* FIX-1111-QQ ("Jordan's ruling, 2026-11-11 (on Chat's recommendation)"): every
   loader animation starts 2.59s into its loop (animation-delay: -2.59s) = 37% of
   the 7s beam loop, the first keyframe where the beam is fully extended, so the
   first paint already shows the beam out. The same delay on float and stretch
   keeps the three in the phase they had at 0s. Cycle and keyframes unchanged. */
@keyframes wpsb-ldr-float {
  50% { transform: translateY(-3.8%); }
}
@keyframes wpsb-ldr-stretch {
  50% { transform: scaleY(1.058); }
}
@keyframes wpsb-ldr-beam {
  0%, 32.44% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 32.8%,51.68% 32.8%,50% 32.8%,48.32% 32.8%,47.6% 32.8%);
    animation-timing-function:linear;
  }
  32.45% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 32.8%,51.68% 34.5%,50% 35.3%,48.32% 34.5%,47.6% 32.8%);
    animation-timing-function:linear;
  }
  36% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 95.5%,51.68% 97.2%,50% 98%,48.32% 97.2%,47.6% 95.5%);
    animation-timing-function:linear;
  }
  37% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 98%,51.68% 98%,50% 98%,48.32% 98%,47.6% 98%);
    animation-timing-function:ease-out;
  }
  47.6%, 78% {
    clip-path:polygon(40% 32.8%,60% 32.8%,76% 98%,63% 98%,50% 98%,37% 98%,24% 98%);
    animation-timing-function:ease-in;
  }
  87% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 98%,51.68% 98%,50% 98%,48.32% 98%,47.6% 98%);
    animation-timing-function:linear;
  }
  88% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 95.5%,51.68% 97.2%,50% 98%,48.32% 97.2%,47.6% 95.5%);
    animation-timing-function:linear;
  }
  91.56%, 100% {
    clip-path:polygon(47.6% 32.8%,52.4% 32.8%,52.4% 32.8%,51.68% 32.8%,50% 32.8%,48.32% 32.8%,47.6% 32.8%);
  }
}

/* Reduced motion -> the same mark, still: saucer at rest, beam at rest (fully
   drawn). Never a second image. */
@media (prefers-reduced-motion: reduce) {
  .wpsb-apploader * { animation: none !important; }
  .wpsb-apploader .ck-anim-beam { clip-path: none; }
}
:root[data-motion='reduced'] .wpsb-apploader * { animation: none !important; }
:root[data-motion='reduced'] .wpsb-apploader .ck-anim-beam { clip-path: none; }
