/* Urboids loading bar (build-loader.js): a building site that keeps building while the backend works.
   Uses the colour names of styles.css (--moss, --sage, --clay, --line, --card, --ink-soft), so dark mode follows. */
.bl {
  display: grid; gap: 8px; width: 100%; padding: 16px 16px 12px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--radius, 16px); background: var(--card);
}
.bl-site { position: relative; height: 64px; overflow: hidden; }
.bl-row { position: absolute; inset: 0 0 0 0; display: flex; align-items: flex-end; gap: 3px; padding-right: 2px; }

/* one building: floor lines and window columns drawn by gradients; it rises floor by floor (clip-path from the JS) */
.bl-building {
  flex: 1 1 0; min-width: 0; border-radius: 2px 2px 0 0; clip-path: inset(100% 0 0 0);
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(255, 255, 255, 0.32) 3px 5px),
    repeating-linear-gradient(to top, transparent 0 5px, rgba(0, 0, 0, 0.16) 5px 7px),
    var(--clay);                                   /* under construction: terracotta */
  transition: clip-path 0.3s ease-out, background-color 0.4s;
}
.bl-building.is-done {
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(255, 255, 255, 0.32) 3px 5px),
    repeating-linear-gradient(to top, transparent 0 5px, rgba(0, 0, 0, 0.16) 5px 7px),
    var(--moss);                                   /* finished: the Urboids green */
}

/* the crane follows the building front (--p, from 0 to 1, set by the JS) */
.bl-crane {
  position: absolute; bottom: 0; width: 40px; height: 64px;
  left: calc(var(--p, 0) * (100% - 40px)); transition: left 0.3s linear;
}
.bl-crane svg { display: block; width: 40px; height: 64px; overflow: visible; }
.bl-steel { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bl-cable { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
.bl-load { fill: var(--clay); }
.bl-hook { transform-origin: 34px 6px; animation: bl-swing 1.6s ease-in-out infinite; }
@keyframes bl-swing {
  0%, 100% { transform: rotate(-7deg) scaleY(1); }
  50% { transform: rotate(7deg) scaleY(1.25); }
}

/* the construction tape under the site: always sliding, so the wait never looks frozen */
.bl-tape {
  height: 8px; border-radius: 4px;
  background: repeating-linear-gradient(-45deg, var(--clay) 0 8px, color-mix(in srgb, var(--clay) 25%, transparent) 8px 16px);
  background-size: 22.6px 22.6px;                  /* one stripe pair (16px) measured across the 45° slant */
  animation: bl-tape 0.9s linear infinite;
}
@keyframes bl-tape { to { background-position: 22.6px 0; } }

.bl-caption { margin: 0; text-align: center; font-size: 0.88rem; color: var(--ink-soft); }
.bl-secs { font-variant-numeric: tabular-nums; }

/* the answer arrived: the last floors go up quickly and the tape stops */
.bl.is-finishing .bl-building { transition-duration: 0.45s; }
.bl.is-finishing .bl-crane { transition-duration: 0.45s; }
.bl.is-finishing .bl-tape { animation: none; background: var(--moss); transition: background 0.3s; }

/* "reduce motion" on: the floors still go up, but the crane does not swing and the tape does not slide */
@media (prefers-reduced-motion: reduce) {
  .bl-building, .bl-crane { transition: none; }
  .bl-hook, .bl-tape { animation: none; }
}
