/* The Bilty loader for the Django pages (LOADER-LEGACY, LOADER-2): the `full` variant of frontend/styles/loader.css under the
   prefix .blg, so it can never meet the Next classes. Colours, timing and fonts come from the --b-* tokens that
   bilty/tokens.css sets for both themes (kryta/base_document.html always imports it). The element is added by
   bilty-loader.js. No filters (iOS Safari). */

.blg {
  --blg-w: 128px;
  --blg-p: calc(var(--blg-w) * 0.2339); /* one road marking + gap = half a wheel turn */
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  /* solid round the mark and the label, so no field border underneath shows through the words */
  background: var(--b-bg);
  background: radial-gradient(11rem 8rem, var(--b-bg) 70%, color-mix(in srgb, var(--b-bg) 88%, transparent));
  pointer-events: none; /* it never takes a click: what is underneath stays usable */
  animation: blg-in 200ms ease-out both;
}
.blg__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.blg__label {
  font-family: "IBM Plex Mono", var(--b-font-mono); /* the Django pages load Plex Mono, not Geist */
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  color: var(--b-text-muted);
}

/* The logo stands on a short road, seen from a little above and to the front; the road is hinged on the wheel line. The road
   is a sibling of the rig with the whole tilt in its own transform (no preserve-3d, which WebKit without a GPU flattens). */
.blg__scene {
  position: relative;
  display: block;
  width: var(--blg-w);
  aspect-ratio: 1041 / 640;
  margin-bottom: calc(var(--blg-w) * 0.2);
  perspective: calc(var(--blg-w) * 5);
}
.blg__rig {
  position: absolute;
  inset: 0;
  display: block;
  transform: rotateX(-22deg) rotateY(20deg);
}
.blg__ground {
  position: absolute;
  top: 100%;
  left: -22%;
  right: -22%;
  display: block;
  height: calc(var(--blg-w) * 0.46);
  overflow: hidden;
  transform-origin: 50% calc(var(--blg-w) * -0.3074);
  transform: rotateX(-22deg) rotateY(20deg) translateY(calc(var(--blg-w) * 0.3074)) rotateX(90deg)
    translateY(calc(var(--blg-w) * -0.3074));
  background:
    radial-gradient(ellipse 36% 62% at 50% 0, rgba(var(--b-shadow-rgb), 0.3), transparent),
    linear-gradient(color-mix(in srgb, var(--b-text) 9%, transparent), color-mix(in srgb, var(--b-text) 3%, transparent));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
}
.blg__lane {
  position: absolute;
  top: 48%;
  left: calc(var(--blg-p) * -1);
  right: 0;
  display: block;
  height: 9%;
  background: repeating-linear-gradient(90deg, var(--b-text-faint) 0 calc(var(--blg-p) * 0.5), transparent 0 var(--blg-p));
  opacity: 0.55;
  animation: blg-drive 0.45s linear infinite;
}
.blg__mark {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: blg-land var(--b-dur-page) var(--b-ease-out) both;
}
.blg__mark g {
  fill: none;
  stroke-width: 28;
  stroke-linejoin: round;
}
.blg__track {
  stroke: var(--b-accent);
}
.blg__track > * {
  stroke-opacity: 0.38;
  transition: stroke-opacity 600ms cubic-bezier(0.23, 1, 0.32, 1);
}
.blg__track > :is(:nth-child(4), :nth-child(6), :nth-child(8)) {
  stroke-opacity: 1;
}
.blg__lit {
  stroke: var(--b-accent-strong);
  stroke-linecap: round;
}
.blg__lit path {
  stroke-dashoffset: var(--a);
  animation: blg-trace 2s linear infinite;
}
.blg__head {
  stroke-dasharray: 200 9000;
  stroke-width: 36;
}
.blg__tail {
  stroke-dasharray: 600 9000;
  stroke-opacity: 0.45;
}
.blg__roll {
  stroke-dasharray: 107 136.5;
  animation: blg-roll 0.9s linear infinite;
}

/* Settled: still up after 8 s (bilty-loader.js adds .blg--slow). */
.blg--slow .blg__lit,
.blg--slow .blg__roll {
  visibility: hidden;
}
.blg--slow .blg__track > * {
  stroke-opacity: 1;
}
.blg--slow .blg__lane {
  animation-play-state: paused;
}

@keyframes blg-in {
  from { opacity: 0; }
}
@keyframes blg-land {
  from { transform: translateY(-9%); }
}
@keyframes blg-trace {
  from { stroke-dashoffset: var(--a); }
  to { stroke-dashoffset: var(--b); }
}
@keyframes blg-roll {
  to { stroke-dashoffset: 487px; }
}
@keyframes blg-drive {
  to { transform: translateX(var(--blg-p)); }
}

/* Reduced motion: the solid mark on its road and the label. Only the 200 ms fade-in stays. */
@media (prefers-reduced-motion: reduce) {
  .blg__lit,
  .blg__roll {
    visibility: hidden;
  }
  .blg__track > * {
    stroke-opacity: 1;
  }
  .blg__mark,
  .blg__lane {
    animation: none;
  }
}
@media (forced-colors: active) {
  .blg__mark g {
    stroke: CanvasText;
  }
  .blg__lit {
    stroke: Highlight;
  }
  .blg__ground {
    display: none;
  }
}
@media print {
  .blg {
    display: none;
  }
}
