/* The loader's look (BRIEF 2.25, superseding the E-L1 tape; BRIEF 2.11's real percentage and smooth running stay).
   The CN Tower assembles itself at night in real 3D on #loader-gl (src/loader/stage.js: raw WebGL2, drawn by a worker
   so a busy main thread never stalls it). Its CSS background is the same night, so the very first paint is already
   dark and the stage's first frame lands on it without a jump.
   The type (2026-11-06, "make the fonts look less generic and AI"; 2026-11-17 one face, the HUD's): one block in the
   HUD's bottom-left column, three levels in IBM Plex Mono, no box behind it.
     label    CNHACKS 2027                 small, tracked out, quiet
     number   064%                          large, tabular figures; each digit rolls up to its new value
                                            through its own mask, the leading zeros dimmed; a hairline under it fills
     line     Teaching the trilobite to sit sentence case; each new line rises in letter by letter
   Every motion is a transform / opacity animation (WAAPI or a CSS transition), so the compositor runs it while the
   main thread decodes and compiles. */
#loader {
  background: transparent; --p: 0;
  /* the block's grid: the HUD's left edge, its bottom line above the sound toggle, the number's and the line's sizes */
  /* (front, one glacier FR2: the widescreen bars are closed through the loader; the block stands wholly above the
     bottom bar, never across its edge: css/frame.css --cn-bar) */
  --ld-x: max(3.8vw, 18px); --ld-b: max(11vh, 64px, calc(var(--cn-bar, 0px) + 28px));
  --ld-num: clamp(58px, 6.4vw + 15px, 134px);   /* (Plex Mono's figures are wider and heavier than the old Geist Light's) */ --ld-line: clamp(14px, 0.35vw + 10px, 17px);
}
#loader-gl {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 15; pointer-events: none;
  background: #07090d;   /* the page's own dark: the stage fades its first frames up from it (stage.js uFade) */
  opacity: 1; transition: opacity 0.75s cubic-bezier(0.45, 0, 0.55, 1); will-change: opacity;
}
/* the hand-off (src/loader/index.js landed): the stage's last frame is the live scene's first (same camera, same sky),
   and its canvas dissolves over that scene while the one camera move of the intro begins */
#loader-gl.ld-out { opacity: 0; }
/* nothing can draw the stage (capture mode, no WebGL2): a quiet dark that fades with the loader's panel */
#loader.ld-flat { background: #07090d; }
#loader-ascii { position: absolute; inset: 0; pointer-events: none; }

/* ---------- the block: bottom-left, on the HUD's left edge, above the sound toggle ---------- */
#loader-lab {
  position: absolute; left: var(--ld-x); bottom: calc(var(--ld-b) + var(--ld-line) * 2.3 + 26px + var(--ld-num) * 0.75 + 14px);
  margin: 0; white-space: nowrap;
  font: 500 clamp(10px, 0.3vw + 6px, 11.5px)/1.4 'IBM Plex Mono', monospace; letter-spacing: 0.24em; text-transform: uppercase;
  color: rgba(237, 239, 242, 0.6); text-shadow: 0 0 14px rgba(4, 6, 11, 0.8);
}
#loader-pct {
  position: absolute; left: var(--ld-x); bottom: calc(var(--ld-b) + var(--ld-line) * 2.3 + 26px);
  margin: 0 0 0 calc(var(--ld-num) * -0.055); white-space: nowrap;
  /* (front 2026-11-17, review look1 "one typeface voice from the first frame"): the HUD's own IBM Plex Mono, the
     weight the HUD loads (500); its line box = the digits' slot */
  font: 500 var(--ld-num)/0.75 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
  color: var(--hud-white);   /* (no shadow: each slot's mask would cut it into a dark box behind the digit) */
}
/* line-height 0.75 (digits only): with IBM Plex Mono's metrics (ascent 1.025, descent 0.275) a 0.75 em line box puts
   the baseline on its bottom edge, so the figures (0 to 0.698 em) stand inside it: each digit's box is its own slot */
.ld-num { display: inline-flex; align-items: flex-start; line-height: 0.75; }
/* a digit: its own slot and mask (clip-path), sized by a hidden tabular 0 so a roll never moves its neighbours, and
   one counter drum in it (.ld-s, index.html): the figures 0-9 0-9 0 one under the other, 0.8 em apart (the slot is
   0.75 em: at rest the figures above and below sit 0.036 em clear of the mask), raised 0.025 em so the figure at
   rest sits exactly where the slot's own 0 would (a line box of 0.8 em puts the baseline 0.025 em lower) */
/* (Plex Mono's figures stand 0.698 em on the baseline, their bowls overshoot it by about 0.012 em: the mask reaches
   0.035 em under the slot, still 0.067 em clear of the drum's next figure) */
.ld-d { position: relative; display: inline-block; clip-path: inset(-0.02em -0.08em -0.035em); transition: opacity 0.6s ease; }
.ld-d b { visibility: hidden; font-weight: inherit; }
.ld-s { position: absolute; left: 0; top: -0.025em; font-style: normal; white-space: pre; line-height: 0.8; will-change: transform; }
.ld-d.ld-lead { opacity: 0.26; }
.ld-pc { font-size: 0.34em; letter-spacing: 0; margin-left: 0.05em; opacity: 0.72; font-weight: 500; }
/* the hairline: a faint track, filled to the percentage (a compositor transition) */
#loader-pct::before, #loader-pct::after {
  content: ''; position: absolute; left: calc(var(--ld-num) * 0.055); right: 0; bottom: -14px; height: 1px;
}
#loader-pct::before { background: rgba(237, 239, 242, 0.16); }
#loader-pct::after {
  background: rgba(237, 239, 242, 0.92); transform-origin: 0 50%; transform: scaleX(var(--p));
  transition: transform 0.45s cubic-bezier(.25, .8, .25, 1);
}
#loader-msg {
  position: absolute; left: var(--ld-x); bottom: var(--ld-b);
  width: min(88vw, 36em); height: 2.3em; margin: 0; box-sizing: border-box;
  font: 500 calc(var(--ld-line) * 0.86)/1.5 'IBM Plex Mono', monospace; letter-spacing: 0.02em;
  /* (a tight shadow: it fades out well inside the mask's bottom edge, 0.6 em under the descenders, so the mask never
     cuts it into a hard-edged band) */
  color: rgba(237, 239, 242, 0.86); text-shadow: 0 0 6px rgba(4, 6, 11, 0.7), 0 1px 2px rgba(4, 6, 11, 0.6);
  clip-path: inset(-0.5em -1em 0 -1em);   /* letters rise in from under the line's own bottom edge */
}
.ld-m { position: absolute; inset: 0; display: flex; align-items: center; white-space: pre; }
/* the line: one text run (.ld-w, kerned); while it rises or leaves, its letters (.ld-c) are placed where the run set
   them (index.html measures the run), one line box high, so each moves on its own and none loses its kerning */
.ld-w { display: block; position: relative; height: 1.5em; }
.ld-c { position: absolute; top: 0; }

/* capture mode (main.js / the inline script add .tape-js): nothing moves, so frames are deterministic */
#loader.tape-js *, #loader.tape-js *::after { animation: none !important; transition: none !important; }

/* reduced motion: the stage builds in place without flying parts (stage.js); digits and lines swap without moving */
@media (prefers-reduced-motion: reduce) {
  #loader-pct::after, .ld-d { transition: none; }
}
