/* HighZak — boot sequence preloader.
   The suit powers on while the hero video streams in. Real progress, not fake. */

.boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #04070d;
  /* the glow breathes brighter as progress climbs (--p = 0 → 1) */
  background-image:
    radial-gradient(
      60vmax 60vmax at 50% 50%,
      rgba(0, 191, 255, calc(0.05 + var(--p, 0) * 0.13)),
      transparent 62%
    );
  transition: opacity 0.9s cubic-bezier(0.65, 0, 0.35, 1),
              transform 1.1s cubic-bezier(0.65, 0, 0.35, 1),
              visibility 0s linear 1.1s;
}

/* faint scanline texture — reads as HUD, not as noise */
.boot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(0, 191, 255, 0.028) 3px 4px
  );
}

/* CSS-ONLY FAILSAFE — if preloader.js never runs (404, parse error, blocked JS),
   nothing would remove this overlay and the whole site would be unreachable.
   This self-dismisses at 20s regardless of JS. The normal path (handover adding
   .is-done) happens seconds earlier and wins. */
@keyframes bootSelfDismiss {
  0%, 97%  { opacity: 1; visibility: visible; }
  100%     { opacity: 0; visibility: hidden; }
}
.boot {
  animation: bootSelfDismiss 20s linear forwards;
}
.boot.is-done {
  animation: none; /* JS took over — use the designed exit instead */
}

.boot__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 0 8vw;
}

/* ---------------- the reactor: logo inside a charging ring ---------------- */
.boot__core {
  position: relative;
  width: clamp(132px, 22vmin, 190px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

/* bloom behind the mark, intensifies with progress */
.boot__core::before {
  content: "";
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 191, 255, calc(0.16 + var(--p, 0) * 0.42)) 0%,
    transparent 68%
  );
  filter: blur(14px);
  transition: background 0.4s linear;
}

.boot__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* start the arc at 12 o'clock */
  overflow: visible;
}
.boot__ring-track {
  fill: none;
  stroke: rgba(0, 191, 255, 0.14);
  stroke-width: 2;
}
.boot__ring-fill {
  fill: none;
  stroke: url(#bootGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(0, 191, 255, 0.85));
  transition: stroke-dashoffset 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.boot__logo {
  position: relative;
  width: 58%;
  height: auto;
  display: block;
  /* logo-mark.png is the alpha-cut mark (the shipped logo.png is an opaque
     navy plate, which showed as a square box on the boot screen). */
  filter: drop-shadow(0 0 18px rgba(0, 191, 255, calc(0.3 + var(--p, 0) * 0.5)));
  animation: bootFloat 3.4s ease-in-out infinite;
}

/* the shine: light glints across the reactor core on a loop */
.boot__shine {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
  background: linear-gradient(
    115deg,
    transparent 40%,
    rgba(160, 225, 255, 0.42) 48%,
    rgba(235, 250, 255, 0.72) 51%,
    rgba(160, 225, 255, 0.42) 54%,
    transparent 62%
  );
  background-size: 260% 100%;
  animation: bootShine 2.8s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}

@keyframes bootShine {
  0%   { background-position: 190% 0; opacity: 0; }
  18%  { opacity: 1; }
  62%  { opacity: 1; }
  75%,
  100% { background-position: -90% 0; opacity: 0; }
}
@keyframes bootFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* ---------------- readout ---------------- */
.boot__readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.boot__pct {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: clamp(2.1rem, 6.5vmin, 3.4rem);
  font-weight: 700;
  line-height: 1;
  color: #dbeeff;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-shadow: 0 0 26px rgba(0, 191, 255, 0.55);
}
.boot__pct sup {
  font-size: 0.42em;
  vertical-align: super;
  color: rgba(0, 191, 255, 0.8);
  margin-left: 2px;
}

.boot__bar {
  width: min(280px, 62vw);
  height: 1px;
  background: rgba(0, 191, 255, 0.16);
  overflow: hidden;
}
.boot__bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0a63ff, #00bfff);
  box-shadow: 0 0 12px rgba(0, 191, 255, 0.9);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.boot__status {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(219, 238, 255, 0.5);
  min-height: 1em;
}
.boot__status::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 10px;
  border-radius: 50%;
  background: #00bfff;
  box-shadow: 0 0 8px #00bfff;
  vertical-align: middle;
  animation: bootBlink 1.15s steps(1) infinite;
}
@keyframes bootBlink {
  0%, 60%   { opacity: 1; }
  61%, 100% { opacity: 0.18; }
}

/* ---------------- exit: iris out, hand over to the site ---------------- */
.boot.is-done {
  opacity: 0;
  transform: scale(1.06);
  visibility: hidden;
  pointer-events: none;
}
/* flash the core at handover — the suit finishing its power-on */
.boot.is-charged .boot__core::before {
  background: radial-gradient(circle, rgba(120, 225, 255, 0.95) 0%, transparent 70%);
}
.boot.is-charged .boot__ring-fill {
  stroke: #9fe9ff;
  filter: drop-shadow(0 0 16px rgba(120, 225, 255, 1));
}

/* NOTE: scrolling during boot is blocked in JS (wheel/touch handlers), NOT in CSS.
   Do NOT add `overflow:hidden` or `height:100%` to html/body here. Either one makes
   documentElement.scrollHeight report 0, and ScrollTrigger + the hero beat-map
   measure during exactly that window — so every scroll animation gets baked
   against a collapsed page height and the whole site scrolls broken. */

/* ---------------- reduced motion: calm, no sweep/float/scanlines ---------------- */
@media (prefers-reduced-motion: reduce) {
  .boot__logo,
  .boot__shine,
  .boot__status::before {
    animation: none !important;
  }
  .boot__shine { display: none; }
  .boot::after { display: none; }
  .boot {
    transition: opacity 0.35s linear, visibility 0s linear 0.35s;
  }
  .boot.is-done { transform: none; }
}
