/* Pixel S loader (concept C). Layout: one centred column (mark, wordmark, tag, bar); Lite version in the corner.
   Animation is transform and opacity only. Resting styles are visible; entrances are keyframes with backwards fill.
   Each cell is an <i> (the grey ghost) with its colour on ::before, so a cell can wait for its turn without a blink. */
:root{
  --l-bg:#eaf6ff; --l-ink:#2a2a72; --l-ink-2:#2a2a72; --l-ghost:rgba(42,42,114,.08); --l-track:rgba(42,42,114,.16);
  --l-fill:#2a2a72; --l-line:rgba(42,42,114,.34); --l-focus:#2a2a72; --l-stop:rgba(42,42,114,.42);
  --l-orange:#ffa400; --l-blue:#009ffd; --l-grey:#232528;
  --l-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --l-bg:#232528; --l-ink:#eaf6ff; --l-ink-2:rgba(234,246,255,.8); --l-ghost:rgba(234,246,255,.07); --l-track:rgba(234,246,255,.16);
  --l-fill:#009ffd; --l-line:rgba(234,246,255,.34); --l-focus:#ffa400; --l-stop:rgba(234,246,255,.42); color-scheme:dark}}
:root[data-theme="dark"]{
  --l-bg:#232528; --l-ink:#eaf6ff; --l-ink-2:rgba(234,246,255,.8); --l-ghost:rgba(234,246,255,.07); --l-track:rgba(234,246,255,.16);
  --l-fill:#009ffd; --l-line:rgba(234,246,255,.34); --l-focus:#ffa400; --l-stop:rgba(234,246,255,.42); color-scheme:dark}

/* site: the concept page's .host/.room stand-in rules are dropped (they clash with the room's .room); css/site.css gives
   .ldr-host the container (cq units) and the fixed layer. Copied from loader/c/loader.css (11 Nov). */
.ldr{position:absolute; inset:0; z-index:2; display:grid; place-items:center; color:var(--l-ink); font-family:var(--l-mono);
  --mh:clamp(110px, min(44cqmin, 42cqh - 60px), 300px); --mw:calc(var(--mh) * 27 / 24)}
.ldr[hidden]{display:none}
.ldr.is-prep{overflow:hidden}                                       /* burst pixels never widen the page */
.ldr.is-ready{pointer-events:none}
.ldr-bg{position:absolute; inset:0; z-index:-1; background:var(--l-bg)}
.ldr-stage{display:flex; flex-direction:column; align-items:center; text-align:center; padding:24px 16px}

/* the mark: each cell's colour pops in on its own turn (--dl, set from JS); the next cell blinks as a cursor */
.ldr-mark{position:relative; width:var(--mw); height:var(--mh); margin-bottom:clamp(20px, 4.5cqmin, 36px)}
.ldr-cells{position:absolute; inset:0}
.ldr-cells i{position:absolute; width:calc(100% / 27 * .84); height:calc(100% / 24 * .84); translate:9.5% 9.5%;
  border-radius:16%; background:var(--l-ghost)}
.ldr-cells i.sm{width:calc(100% / 27 * .46); height:calc(100% / 24 * .46); translate:58.7% 58.7%}
.ldr-cells i::before{content:""; position:absolute; inset:0; border-radius:inherit; opacity:0}
.ldr-cells i.c0::before{background:#ffa400} .ldr-cells i.c1::before{background:#ffb226} .ldr-cells i.c2::before{background:#ffbf4d}
.ldr-cells i.c3::before{background:#009ffd} .ldr-cells i.c4::before{background:#26aefd} .ldr-cells i.c5::before{background:#4dbcfe}
.ldr-cells i.on::before{opacity:1; animation:ldr-pop .2s cubic-bezier(.34,1.56,.64,1) var(--dl, 0ms) backwards}
.ldr-cells i.next::after{content:""; position:absolute; inset:0; border-radius:inherit; background:var(--l-fill); opacity:.35;
  animation:ldr-blink 1s ease-in-out infinite alternate}
.ldr.is-ready .ldr-cells i{will-change:transform}                  /* layers ready just before the burst */
@keyframes ldr-pop{from{transform:scale(.2); opacity:0}}
@keyframes ldr-blink{from{opacity:0}}

/* the field (round 5): one canvas over the whole screen, under the loader (z 20, site.css) and over the room; it lies
   under the solid .ldr-bg while loading (round 6: the waiting screen stays plain), in exactly its colour, and takes over
   at the exit when .ldr-bg is hidden, then flies off (loader.js) */
.ldr-field{position:fixed; inset:0; width:100%; height:100%; z-index:19; pointer-events:none}
.ldr.is-prep .ldr-bg,.ldr.is-prep .ldr-cells{visibility:hidden}
.ldr.is-prep .ldr-fx{will-change:opacity}

/* words */
.ldr-wm{margin:0; font-weight:700; font-size:clamp(20px, 3.6cqmin, 32px); line-height:1.1; letter-spacing:-.01em; white-space:nowrap}
.ldr-wm .b{color:var(--l-blue)} .ldr-wm .s{color:var(--l-orange)}
.ldr-tag{margin:.7em 0 0; font-weight:500; font-size:clamp(11px, 1.5cqmin, 13px); letter-spacing:.24em; text-transform:uppercase; color:var(--l-ink-2)}

/* bar */
.ldr-bar{width:calc(var(--mw) * .72); height:3px; margin-top:clamp(18px, 3.4cqmin, 28px); border-radius:2px; background:var(--l-track); overflow:hidden}
.ldr-bar i{display:block; height:100%; background:var(--l-fill); transform-origin:0 50%; transform:scaleX(var(--p, 0)); transition:transform .45s cubic-bezier(.3,.7,.3,1)}

/* Lite version: always there; becomes the main button when loading stops */
.ldr-act{position:absolute; z-index:3; right:max(16px, env(safe-area-inset-right, 0px)); bottom:calc(16px + env(safe-area-inset-bottom, 0px));
  display:flex; gap:10px; align-items:center}
.ldr-lite{display:inline-flex; align-items:center; min-height:44px; padding:0 16px; border:1px solid var(--l-line); border-radius:22px;
  background:var(--l-bg); color:var(--l-ink); font:500 14px/1 var(--l-mono); text-decoration:none}
.ldr-lite:hover{border-color:var(--l-ink)}
.ldr-retry{display:none; width:48px; height:48px; place-items:center; padding:0; border:1px solid var(--l-line); border-radius:50%;
  background:transparent; color:var(--l-ink); cursor:pointer}
.ldr-retry svg{width:20px; height:20px}
.ldr a:focus-visible,.ldr button:focus-visible{outline:2px solid var(--l-focus); outline-offset:3px}
.ldr-sr{position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; margin:0}

/* stalled or failed: the S rests, Lite version moves under the bar as the main button */
.ldr[data-state="stalled"] .ldr-cells,.ldr[data-state="failed"] .ldr-cells{opacity:.5; transition:opacity .4s}
.ldr[data-state="stalled"] .ldr-cells i.next::after,.ldr[data-state="failed"] .ldr-cells i.next::after{display:none}
.ldr[data-state="stalled"] .ldr-bar i,.ldr[data-state="failed"] .ldr-bar i{background:var(--l-stop)}
.ldr[data-state="stalled"] .ldr-act,.ldr[data-state="failed"] .ldr-act,.no-js .ldr-act{position:static; margin-top:24px; animation:ldr-up .4s cubic-bezier(.2,.8,.3,1) backwards}
.ldr[data-state="stalled"] .ldr-lite,.ldr[data-state="failed"] .ldr-lite,.no-js .ldr-lite{min-height:48px; padding:0 22px; border-color:var(--l-orange);
  background:var(--l-orange); color:var(--l-grey); font-weight:700; font-size:15px}
.ldr[data-state="stalled"] .ldr-retry,.ldr[data-state="failed"] .ldr-retry{display:grid}
@keyframes ldr-up{from{opacity:0; transform:translateY(8px)}}
.ldr.is-prep .ldr-act,.ldr.is-quick .ldr-act{visibility:hidden}

/* no script: no room either, so Lite version leads */
.no-js .ldr-mark,.no-js .ldr-bar{display:none}

/* reduced motion: the whole S, a plain bar, a short fade out (no burst) */
.ldr[data-motion="reduce"] .ldr-cells i::before{opacity:1; animation:none}
.ldr[data-motion="reduce"] .ldr-cells i.next::after{display:none}
.ldr[data-motion="reduce"] .ldr-bar i,.ldr[data-motion="reduce"] .ldr-act{transition:none; animation:none}
.ldr[data-motion="reduce"] .ldr-cells{transition:none}

/* test hook (?p=40): no transitions, so a still shot shows the exact state */
.still .ldr *,.still .ldr *::before,.still .ldr *::after{transition:none!important; animation-duration:0s!important; animation-delay:0s!important}
