/* ==========================================================================
   G01 preloader: shared overlay base
   Every concept builds inside .rxp__stage and is scoped by its own prefix
   (.c01- … .c10-). The overlay is a size container, so concepts size
   themselves with cq units and recompose with @container queries. That is
   what lets one implementation run full-screen, in a simulated device and in
   a thumbnail.
   ========================================================================== */

.rxp {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  overflow: hidden;
  background: transparent;
  color: var(--rx-white);
  font: 400 16px/1.4 var(--rx-font-display);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  container: rxp / size;
  contain: layout paint style;
  /* CSS fail-safe: if scripts never run, the overlay still gets out of the way. */
  animation: rxp-failsafe 0.4s linear 6s forwards;
}

.rxp, .rxp *, .rxp *::before, .rxp *::after { box-sizing: border-box; }

html.rx-preloading .rxp,
.rx-stage.is-preloading .rxp { display: block; }

.rx-stage .rxp { position: absolute; }

/* The controller takes over (JS hard cap) and disables the CSS fail-safe. */
.rxp.is-controlled { animation: none; }

@keyframes rxp-failsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* First frame: until a concept has built its own ground, the stage paints the
   concept's ground colour, so the very first frame is already intentional. */
.rxp__stage {
  position: absolute;
  inset: 0;
  background: var(--rxp-first-frame, var(--rx-obsidian));
}
.rxp[data-concept="c01"] { --rxp-first-frame: var(--rx-obsidian); }
.rxp[data-concept="c02"] { --rxp-first-frame: var(--rx-bone); }
.rxp[data-concept="c03"] { --rxp-first-frame: var(--rx-black); }
.rxp[data-concept="c04"] { --rxp-first-frame: var(--rx-red); }
.rxp[data-concept="c05"] { --rxp-first-frame: var(--rx-graphite-900); }
.rxp[data-concept="c06"] { --rxp-first-frame: #0f0e0d; }
.rxp[data-concept="c07"] { --rxp-first-frame: var(--rx-paper); }
.rxp[data-concept="c08"] { --rxp-first-frame: #08080a; }
.rxp[data-concept="c09"] { --rxp-first-frame: #0b0c0e; }
.rxp[data-concept="c10"] { --rxp-first-frame: var(--rx-obsidian); }
.rxp.is-built .rxp__stage { background: transparent; }

.rxp__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip control: quiet, always reachable, high contrast on every ground. */
.rxp__skip {
  position: absolute;
  z-index: 20;
  right: max(16px, calc(env(safe-area-inset-right, 0px) + 16px));
  bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--rxp-skip-fg, var(--rx-white)) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--rxp-skip-bg, var(--rx-obsidian)) 72%, transparent);
  color: var(--rxp-skip-fg, var(--rx-white));
  font: 500 11px/1 var(--rx-font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  animation: rxp-skip-in 0.4s var(--rx-ease-out) 0.5s forwards;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.rxp__skip::after {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.rxp__skip:hover { border-color: currentColor; }
.rxp__skip:focus-visible {
  opacity: 1;
  outline: 2px solid var(--rxp-skip-fg, var(--rx-white));
  outline-offset: 3px;
}
.rxp[data-skip-tone="dark"] { --rxp-skip-fg: var(--rx-ink); --rxp-skip-bg: var(--rx-paper); }

@keyframes rxp-skip-in { to { opacity: 0.86; } }

/* Thumbnails and stills never show the skip control. */
.rx-stage.is-still .rxp__skip { display: none; }

/* --------------------------------------------------------------------------
   Shared brand-mark styling (monogram + wordmark SVGs from RX.brand)
   -------------------------------------------------------------------------- */
.rx-mono { display: block; overflow: visible; }
.rx-mono__disc { fill: var(--rx-mono-disc, #fff); }
.rx-mono__ring { fill: none; stroke: var(--rx-mono-ink, var(--rx-red)); }
.rx-mono__trace {
  fill: none;
  stroke: var(--rx-mono-ink, var(--rx-red));
  stroke-linejoin: miter;
  stroke-miterlimit: 8;
  stroke-linecap: butt;
}
.rx-mono__dot { fill: var(--rx-mono-ink, var(--rx-red)); }

.rx-wm { display: block; overflow: visible; }
.rx-wm__letter { fill: var(--rx-wm-ink, currentColor); }
.rx-wm__dot { fill: var(--rx-wm-dot, var(--rx-red)); }

/* Scroll locking. html is locked by the boot script before first paint. */
html.rx-preloading,
html.rx-scroll-locked { overflow: hidden; }
html.rx-scroll-locked body { padding-right: var(--rx-sbw, 0px); }
.rx-scroll-locked.rx-stage__scroller { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .rxp__skip { animation-duration: 0.01s; animation-delay: 0s; }
}
