/* ==========================================================================
   OPENING SEQUENCE
   A short "system coming online" moment before the page is revealed.
   The overlay is created by JS, so if the script fails or is blocked the
   page simply renders normally — the content is never gated on this.
   ========================================================================== */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: grid;
  place-items: center;
  will-change: transform;
}

/* faint dot-matrix field, echoing the display font */
.preloader::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
  pointer-events: none;
}

/* violet bloom behind the wordmark */
.preloader::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 120vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(124, 58, 237, 0.16) 0%,
    rgba(124, 58, 237, 0.05) 34%,
    rgba(124, 58, 237, 0) 68%
  );
  pointer-events: none;
}

.pre-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
}

.pre-word {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 64px);
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 26px rgba(124, 58, 237, 0.55);
}

/* characters still resolving read dimmer than settled ones */
.pre-word .ch {
  opacity: 0.32;
  transition: opacity 0.18s ease;
}

.pre-word .ch.set {
  opacity: 1;
}

.pre-sub {
  font-family: var(--font-display);
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(255, 255, 255, 0.42);
  text-transform: uppercase;
}

.pre-bar {
  width: min(220px, 52vw);
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.pre-bar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), #fff);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s linear;
}

/* the reveal: overlay lifts away */
.preloader.done {
  transform: translateY(-100%);
  transition: transform 0.75s cubic-bezier(0.76, 0, 0.24, 1);
}

.preloader.done .pre-inner {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* page entrance animations wait behind the overlay instead of playing unseen */
html.is-preloading .anim {
  animation-play-state: paused;
}

/* the home page locks scrolling anyway; this covers the interior pages */
html.is-preloading,
html.is-preloading body {
  overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
  .preloader {
    display: none;
  }

  html.is-preloading .anim {
    animation-play-state: running;
  }

  html.is-preloading,
  html.is-preloading body {
    overflow: revert !important;
  }
}
