#root { visibility: hidden; }
#root.is-ready { visibility: visible; }

/* The opening: a dark curtain in two halves. The word rises from the seam, a counter runs in the
   corner; when the page is ready the seam flares red edge to edge and the halves part. */
@property --boot-n {
  syntax: '<integer>';
  initial-value: 0;
  inherits: false;
}
.boot-loader {
  position: fixed;
  z-index: 9999;
  inset: 0;
  overflow: hidden;
  color: #f3f3f1;
  opacity: 1;
  /* opacity only flips once the halves are gone (App.tsx waits for its transitionend) */
  transition: opacity 1ms linear 1150ms, visibility 0s 1150ms;
}
.boot-loader.is-exiting { opacity: 0; visibility: hidden; }
.boot-loader__half {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: #0c0c0d;
  transition: transform 850ms cubic-bezier(0.76, 0, 0.24, 1) 300ms;
}
.boot-loader__half--top { top: 0; height: 50%; align-items: flex-end; }
/* a pixel of overlap, so no hairline of the page shows through the seam */
.boot-loader__half--bottom { top: calc(50% - 1px); bottom: 0; align-items: flex-start; }
.boot-loader.is-exiting .boot-loader__half--top { transform: translateY(-101%); }
.boot-loader.is-exiting .boot-loader__half--bottom { transform: translateY(101%); }

.boot-loader__word {
  padding-bottom: 0.2em;
  font: 900 clamp(34px, 9.5vw, 148px)/0.86 'Unbounded', system-ui, sans-serif;
  letter-spacing: -0.05em;
  /* waits below the seam until its font is in (boot-lang.js adds .is-lit), then rises from it */
  transform: translateY(125%);
  transition: transform 900ms cubic-bezier(0.16, 1, 0.3, 1);
}
.boot-loader.is-lit .boot-loader__word { transform: none; }
.boot-loader__word span { color: #e3141b; }

.boot-loader__caption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
  color: #aaa;
  font: 11px/1.4 ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.boot-loader__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e3141b;
  box-shadow: 0 0 16px #e3141b;
  animation: boot-pulse 1s ease-in-out infinite alternate;
}

/* runs toward 92 while the page loads and lands on 100 as the curtain opens */
.boot-loader__count {
  position: absolute;
  right: clamp(16px, 3vw, 44px);
  bottom: clamp(14px, 3vw, 36px);
  font: 900 clamp(54px, 12vw, 184px)/0.8 'Unbounded', system-ui, sans-serif;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  counter-reset: boot var(--boot-n);
  animation: boot-count 6s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}
.boot-loader__count::after { content: counter(boot, decimal-leading-zero); }
.boot-loader.is-exiting .boot-loader__count {
  --boot-n: 100;
  animation: none;
  transition: --boot-n 260ms linear;
}

/* the seam: a short track with a runner while loading, a red line across the screen at the end */
.boot-loader__line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  margin-top: -1px;
  overflow: hidden;
  background: #29292b;
  clip-path: inset(0 calc(50% - min(90px, 24vw)));
  transition: clip-path 320ms cubic-bezier(0.7, 0, 0.2, 1), background-color 200ms, opacity 350ms 650ms;
}
.boot-loader__line::after {
  content: '';
  position: absolute;
  top: 0;
  left: calc(50% - min(90px, 24vw));
  width: 72px;
  height: 100%;
  background: #e3141b;
  animation: boot-progress 1.2s ease-in-out infinite;
}
.boot-loader.is-exiting .boot-loader__line {
  clip-path: inset(0);
  background: #e3141b;
  box-shadow: 0 0 24px #e3141b;
  opacity: 0;
}

@keyframes boot-pulse { to { opacity: 0.35; } }
@keyframes boot-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(260%); }
}
@keyframes boot-count { to { --boot-n: 92; } }
@media (prefers-reduced-motion: reduce) {
  .boot-loader, .boot-loader__half, .boot-loader__word, .boot-loader__count, .boot-loader__dot, .boot-loader__line, .boot-loader__line::after {
    animation: none;
    transition-duration: 0.01ms;
    transition-delay: 0s;
  }
  .boot-loader__word { transform: none; }
  .boot-loader__count { --boot-n: 100; }
}
