/* SolutionTee Edu Academy — the first-visit loader
   =========================================================================
   Moved out of components.css unchanged.

   The timings below are transcribed frame for frame from the supplied
   Lottie files, not designed here — the dash lengths are measured from
   the path geometry and the delays are the artwork's own. Re-deriving
   any of it by eye would lose the choreography the mark was drawn to.

   Only token NAMES were updated: --color-bg to --canvas, --logo-* to
   --mark-*, and the hard-coded z-index 300 to --z-loader. Every
   duration, delay, dash length and easing is as it was.
   ====================================================================== */

/* ========================================================================
   FIRST-VISIT LOADER
   Shown once, only when the head script sets data-loader on <html>.

   Two things dismiss it, and neither is this stylesheet:

     - loader.js fades it out once the page has loaded (the nice path);
     - a setTimeout in the head script removes data-loader outright at
       3.2s (the backstop), which instantly returns this rule to
       display:none.

   The backstop is a timer rather than a CSS animation on purpose. An
   animation only advances while the document timeline is running, so a
   tab that is never composited would hold the overlay open; a timer
   fires regardless. Nothing about the overlay staying up may depend on
   something that can quietly stall.
   ===================================================================== */

.loader {
  display: none;
}

:root[data-loader] .loader {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  background: var(--canvas);
}

/* Dismissed early by the script: the same end state, reached sooner. */
:root[data-loader] .loader.is-done {
  animation: loader-clear 260ms var(--ease-out) forwards;
}

@keyframes loader-clear {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; pointer-events: none; }
}

.loader__mark {
  width: clamp(84px, 18vw, 132px);
  height: auto;
}

/* ---- Trace: draws over f5-f41 (0.167s - 1.367s) ------------------------
   Path length is 953 user units, measured from the geometry: the five
   segments are 226 + 118 + 219 + 118 + 272. */
.loader__trace {
  stroke-dasharray: 953;
  stroke-dashoffset: 953;
  animation: loader-draw-trace 1200ms var(--ease-out) 167ms forwards;
}

@keyframes loader-draw-trace {
  to { stroke-dashoffset: 0; }
}

/* ---- Crossbar: draws over f18-f27 (0.600s - 0.900s), length 219 ------- */
.loader__crossbar {
  stroke-dasharray: 219;
  stroke-dashoffset: 219;
  animation: loader-draw-crossbar 300ms var(--ease-out) 600ms forwards;
}

@keyframes loader-draw-crossbar {
  to { stroke-dashoffset: 0; }
}

/* ---- Nodes: a 40% -> 108% -> 100% pop, as in the file ------------------ */
.loader__node {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.loader__node--amber {
  animation: loader-pop 467ms var(--ease-out) forwards;
}

/* Lands as the trace finishes, at f38. */
.loader__node--navy {
  animation: loader-pop 433ms var(--ease-out) 1267ms forwards;
}

@keyframes loader-pop {
  0%   { opacity: 0; transform: scale(0.4); }
  30%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---- Pulse: a short dash travelling the trace, looping from f52 --------
   In the file this is the same path under a trim whose offset runs
   0 -> 720 degrees, i.e. two laps. One lap is 1617ms. */
.loader__pulse {
  opacity: 0;
  stroke-dasharray: 90 863;
  stroke-dashoffset: 953;
  animation: loader-pulse-in 200ms linear 1533ms forwards,
             loader-pulse-run 1617ms linear 1733ms infinite;
}

@keyframes loader-pulse-in {
  to { opacity: 1; }
}

@keyframes loader-pulse-run {
  from { stroke-dashoffset: 953; }
  to   { stroke-dashoffset: 0; }
}

/* Nothing here is worth motion sickness. The head script already skips
   the overlay under reduced motion; this covers the case where the
   preference changes after the attribute was set. */
@media (prefers-reduced-motion: reduce) {
  :root[data-loader] .loader {
    animation: loader-clear 1ms linear forwards;
  }
}
