/* THE VEIL — 2027 boot sequence. Full-screen loading scene shown once per browser session. */

html.v-booting body > *:not(#veilBoot) {
  visibility: hidden;
}

#veilBoot {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(900px circle at 50% 42%, rgba(0, 181, 255, 0.10), transparent 60%),
    radial-gradient(700px circle at 50% 110%, rgba(212, 175, 55, 0.10), transparent 60%),
    #040509;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color: #f2ead2;
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
#veilBoot.is-leaving {
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
}

/* Matrix rain */
#veilBoot .vb-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

/* Soft scanlines for the screen look */
#veilBoot::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Centre stack: logo, then the windows */
#veilBoot .vb-stack {
  position: relative;
  z-index: 2;
  width: min(92vw, 760px);
  display: grid;
  gap: 22px;
  justify-items: center;
}

#veilBoot .vb-logo {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: clamp(34px, 7vw, 68px);
  letter-spacing: 0.22em;
  background: linear-gradient(180deg, #fff6d6 0%, #d4af37 55%, #a8842a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.25));
  animation: vbLogo 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
#veilBoot .vb-logo-sub {
  margin: -10px 0 0;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: #7fd8ff;
  text-transform: uppercase;
  animation: vbFade 1s 0.5s ease both;
}

/* The desktop windows */
#veilBoot .vb-windows {
  width: 100%;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}
#veilBoot .vb-win {
  position: relative;
  background: linear-gradient(160deg, rgba(14, 20, 34, 0.86), rgba(6, 9, 16, 0.82));
  border: 1px solid rgba(0, 181, 255, 0.35);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 181, 255, 0.10);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  filter: blur(6px);
  animation: vbWinIn 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
#veilBoot .vb-win:nth-child(1) { animation-delay: 1.0s; }
#veilBoot .vb-win:nth-child(2) { animation-delay: 2.2s; }
#veilBoot .vb-win:nth-child(3) { animation-delay: 3.4s; }
#veilBoot .vb-win:nth-child(3) { grid-column: 1 / -1; }

#veilBoot .vb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  background: rgba(0, 181, 255, 0.10);
  border-bottom: 1px solid rgba(0, 181, 255, 0.22);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #a9d9f2;
  text-transform: uppercase;
}
#veilBoot .vb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(0, 181, 255, 0.5);
}
#veilBoot .vb-dot:nth-child(2) { background: rgba(212, 175, 55, 0.7); }
#veilBoot .vb-dot:nth-child(3) { background: rgba(255, 255, 255, 0.25); }
#veilBoot .vb-bar span:last-child { margin-left: auto; opacity: 0.7; }

#veilBoot .vb-body {
  padding: 14px 16px 16px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #cfe9f7;
  min-height: 132px;
}
#veilBoot .vb-line { display: block; white-space: nowrap; overflow: hidden; }
#veilBoot .vb-line.ok { color: #f5e6b8; }
#veilBoot .vb-line.ok::before { content: '[ OK ] '; color: #7fd8ff; }
#veilBoot .vb-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: #00b5ff;
  animation: vbBlink 0.9s steps(1) infinite;
}

/* Gauges in the third window */
#veilBoot .vb-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 14px 16px 16px;
}
#veilBoot .vb-gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #a9b3c3;
  text-transform: uppercase;
  margin-bottom: 6px;
}
#veilBoot .vb-track {
  position: relative;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
#veilBoot .vb-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #00b5ff, #7fd8ff);
  box-shadow: 0 0 14px rgba(0, 181, 255, 0.7);
  transition: width 0.25s linear;
}
#veilBoot .vb-fill.gold {
  background: linear-gradient(90deg, #a8842a, #f5e6b8);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.6);
}

#veilBoot .vb-progress {
  width: 100%;
  display: grid;
  gap: 8px;
}
#veilBoot .vb-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #a9b3c3;
  text-transform: uppercase;
}
#veilBoot .vb-progress-track {
  position: relative;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#veilBoot .vb-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #d4af37, #f5e6b8, #00b5ff);
  box-shadow: 0 0 16px rgba(0, 181, 255, 0.6);
}

#veilBoot .vb-actions {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 12px;
  animation: vbFade 1s 1.2s ease both;
}
#veilBoot .vb-btn {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: #f5e6b8;
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, color 0.25s;
}
#veilBoot .vb-btn:hover,
#veilBoot .vb-btn:focus-visible {
  border-color: #00b5ff;
  color: #ffffff;
  box-shadow: 0 0 22px rgba(0, 181, 255, 0.35);
  outline: none;
}
#veilBoot .vb-btn[hidden] {
  display: none;
}

/* Keyframes */
@keyframes vbWinIn {
  0% { opacity: 0; translate: 0 26px; scale: 0.94; filter: blur(10px); }
  to { opacity: 1; translate: 0 0; scale: 1; filter: blur(0); }
}
@keyframes vbScan {
  0% { top: 0; opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes vbSpin {
  to { transform: rotate(360deg); }
}
@keyframes vbSpinBack {
  to { transform: rotate(-360deg); }
}
@keyframes vbFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes vbLogo {
  from { opacity: 0; letter-spacing: 0.5em; filter: blur(12px); }
  to { opacity: 1; letter-spacing: 0.22em; filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.25)); }
}
@keyframes vbBlink {
  50% { opacity: 0; }
}

@media (max-width: 640px) {
  #veilBoot .vb-windows { grid-template-columns: 1fr; }
  #veilBoot .vb-gauges { grid-template-columns: 1fr; }
  #veilBoot .vb-body { font-size: 11.5px; min-height: 118px; }
}

/* INTRO toggle: its own slot in the bottom row. site.css forces .sound-control to !important
   positions, so these match that with !important as well. */
.boot-control {
  position: fixed;
  z-index: 50;
}
.sound-control.boot-control {
  right: 305px !important;
  bottom: 31px !important;
}
.boot-control.is-muted {
  opacity: 0.6;
}
@media (max-width: 640px) {
  /* On phones it sits above MUSIC, on the left, so nothing overlaps */
  .sound-control.boot-control {
    left: 30px !important;
    right: auto !important;
    bottom: 118px !important;
  }
}

/* Window build: a bright scan line sweeps down the window as it opens */
#veilBoot .vb-win::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #7fd8ff, transparent);
  box-shadow: 0 0 18px #00b5ff;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}
#veilBoot .vb-win:nth-child(1)::before { animation: vbScan 1.2s 1.0s ease-in both; }
#veilBoot .vb-win:nth-child(2)::before { animation: vbScan 1.2s 2.2s ease-in both; }
#veilBoot .vb-win:nth-child(3)::before { animation: vbScan 1.2s 3.4s ease-in both; }

/* Decode stage in the boot window: a spinning ring, a title, and a hex stream */
#veilBoot .vb-decode {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 10px 0 6px;
  min-height: 128px;
  align-content: center;
}
#veilBoot .vb-decode.is-done {
  display: none;
}
#veilBoot .vb-ring {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(0, 181, 255, 0.15);
  opacity: 0.4;
  transition: opacity 0.4s ease;
}
#veilBoot .vb-ring.is-on {
  opacity: 1;
}
#veilBoot .vb-ring::before,
#veilBoot .vb-ring::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
}
#veilBoot .vb-ring::before {
  border-top-color: #00b5ff;
  border-right-color: rgba(0, 181, 255, 0.4);
  animation: vbSpin 1s linear infinite;
  box-shadow: 0 0 14px rgba(0, 181, 255, 0.5);
}
#veilBoot .vb-ring::after {
  inset: 9px;
  border-bottom-color: #d4af37;
  border-left-color: rgba(212, 175, 55, 0.4);
  animation: vbSpinBack 1.6s linear infinite;
}
#veilBoot .vb-decode-text {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.26em;
  color: #7fd8ff;
  min-height: 1.4em;
}
#veilBoot .vb-hex {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(0, 181, 255, 0.55);
  white-space: pre;
  min-height: 4.1em;
  text-align: center;
}

/* ---------- 3D windows ----------
   Each window is a glass slab in depth. The entrance uses translate and scale, and the
   pointer tilt uses transform, so the two never fight over the same property. */
#veilBoot .vb-windows {
  perspective: 1800px;
}
#veilBoot .vb-win {
  transform: none;
  transform-style: preserve-3d;
  background:
    linear-gradient(165deg, rgba(60, 84, 120, 0.42) 0%, rgba(10, 15, 28, 0.2) 40%, rgba(6, 9, 18, 0.92) 100%);
  border: 1px solid rgba(160, 225, 255, 0.32);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -24px 36px -24px rgba(0, 0, 0, 0.75),
    inset 1px 0 0 rgba(255, 255, 255, 0.05),
    0 2px 0 rgba(0, 181, 255, 0.22),
    0 44px 70px -12px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(0, 181, 255, 0.12);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.4s ease;
  will-change: transform;
}
/* Depth: the left and right windows angle toward the centre, the lower one tips up */
#veilBoot .vb-win:nth-child(1) { rotate: y 10deg; }
#veilBoot .vb-win:nth-child(2) { rotate: y -10deg; }
#veilBoot .vb-win:nth-child(3) { rotate: x 6deg; }

/* A glossy reflection across the glass */
#veilBoot .vb-win::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 66%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
  z-index: 3;
}

/* The title bar floats above the body; the body floats above the glass */
#veilBoot .vb-win > .vb-bar {
  transform: translateZ(24px);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(0, 181, 255, 0.26), rgba(0, 181, 255, 0.06));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}
#veilBoot .vb-win > .vb-body,
#veilBoot .vb-win > .vb-gauges,
#veilBoot .vb-win > .vb-progress,
#veilBoot .vb-win > div:not(.vb-bar) {
  transform: translateZ(12px);
}

@media (max-width: 640px) {
  #veilBoot .vb-win { rotate: none; }
  /* Let the 3D space show through the windows on phones */
  #veilBoot .vb-win {
    background: linear-gradient(160deg, rgba(10, 16, 30, 0.45), rgba(6, 10, 20, 0.35)) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }
}

html, body, * { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
